mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-21 20:50:40 +00:00
feat: add option to set custom label on progress shortcode (#412)
This commit is contained in:
parent
9be026819d
commit
a611955251
@ -450,7 +450,8 @@ Text continues here.
|
|||||||
|
|
||||||
| Name | Description | default |
|
| Name | Description | default |
|
||||||
| ---------------- | -------------------------------------------------------------------------------- | --------- |
|
| ---------------- | -------------------------------------------------------------------------------- | --------- |
|
||||||
| value | progress value | 0 |
|
| value | progress value (0-100) | 0 |
|
||||||
|
| label | value to display | value |
|
||||||
| icon (optional) | icon to use, need to be an icon from an [SVG sprite](/posts/features/icon-sets/) | undefined |
|
| icon (optional) | icon to use, need to be an icon from an [SVG sprite](/posts/features/icon-sets/) | undefined |
|
||||||
| title (optional) | progress title | undefined |
|
| title (optional) | progress title | undefined |
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{{- $value := default 0 (.Get "value") -}}
|
{{- $value := default 0 (.Get "value") -}}
|
||||||
|
{{- $label := default (printf "%v %%" $value) (.Get "label") -}}
|
||||||
{{- $title := .Get "title" -}}
|
{{- $title := .Get "title" -}}
|
||||||
{{- $icon := .Get "icon" -}}
|
{{- $icon := .Get "icon" -}}
|
||||||
|
|
||||||
@ -11,13 +12,13 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{ with $title }}<span>{{ . }}</span>{{ end }}
|
{{ with $title }}<span>{{ . }}</span>{{ end }}
|
||||||
</div>
|
</div>
|
||||||
<div>{{ $value }}%</div>
|
<div>{{ $label }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gblog-progress__wrap">
|
<div class="gblog-progress__wrap">
|
||||||
<div
|
<div
|
||||||
class="gblog-progress__bar"
|
class="gblog-progress__bar"
|
||||||
data-percent="{{ $value }}"
|
data-percent="{{ $value }}"
|
||||||
style="width: {{ $value }}%;"
|
style="width: {{ $value }}%; max-width: 100%; min-width: 0"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user