-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add progress bar shortcode (#594)
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: Progress | ||
--- | ||
|
||
A progress bar shows how far a process has progressed. | ||
|
||
## Attributes | ||
|
||
| Name | Description | default | | ||
| ---------------- | -------------------------------------------------------------------------- | --------- | | ||
| value | progress value | 0 | | ||
| icon (optional) | icon to use, need to be an icon from an [SVG sprite](/features/icon-sets/) | undefined | | ||
| title (optional) | progress title | undefined | | ||
|
||
## Usage | ||
|
||
<!-- prettier-ignore-start --> | ||
```tpl | ||
{{</* progress title=Eating value=65 icon=gdoc_heart */>}} | ||
``` | ||
<!-- prettier-ignore-end --> | ||
|
||
## Example | ||
|
||
<!-- prettier-ignore-start --> | ||
<!-- spellchecker-disable --> | ||
{{< progress title=Eating value=65 icon=gdoc_heart >}} | ||
<!-- spellchecker-enable --> | ||
<!-- prettier-ignore-end --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- $value := default 0 (.Get "value") -}} | ||
{{- $title := .Get "title" -}} | ||
{{- $icon := .Get "icon" -}} | ||
|
||
|
||
<div class="gdoc-progress"> | ||
<div class="gdoc-progress__label flex justify-between"> | ||
<div class="gdoc-progress__label--name flex align-center"> | ||
{{ with $icon -}} | ||
<svg class="gdoc-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg> | ||
{{- end }} | ||
{{ with $title }}<span>{{ . }}</span>{{ end }} | ||
</div> | ||
<div>{{ $value }}%</div> | ||
</div> | ||
<div class="gdoc-progress__wrap"> | ||
<div | ||
class="gdoc-progress__bar" | ||
data-percent="{{ $value }}" | ||
style="width: {{ $value }}%;" | ||
></div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters