feat: support hint colors for progress shortcode (#967)
This commit is contained in:
parent
93979d48dd
commit
eecddaf0f1
|
@ -24,5 +24,15 @@ A progress bar shows how far a process has progressed.
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
{{< progress title=Eating value=65 icon=gdoc_heart >}}
|
{{< progress title=Eating value=65 icon=gdoc_heart >}}
|
||||||
|
|
||||||
|
{{< progress title="Type: note" value=10 icon=gdoc_heart type=note >}}
|
||||||
|
|
||||||
|
{{< progress title="Type: tip" value=70 icon=gdoc_heart type=tip >}}
|
||||||
|
|
||||||
|
{{< progress title="Type: important" value=30 icon=gdoc_heart type=important >}}
|
||||||
|
|
||||||
|
{{< progress title="Type: caution" value=90 icon=gdoc_heart type=caution >}}
|
||||||
|
|
||||||
|
{{< progress title="Type: warning" value=80 icon=gdoc_heart type=warning >}}
|
||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
---
|
---
|
||||||
properties:
|
properties:
|
||||||
|
- name: type
|
||||||
|
type: string
|
||||||
|
description: Color type of the progress bar. Supported values are `main|note|tip|important|caution|warning`.
|
||||||
|
required: false
|
||||||
|
defaultValue: main
|
||||||
- name: value
|
- name: value
|
||||||
type: integer
|
type: integer
|
||||||
description: Progress value.
|
description: Progress value.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{ $type := default "note" (.Get "type") }}
|
{{- $type := default "note" (.Get "type") }}
|
||||||
{{ $icon := .Get "icon" }}
|
{{- $icon := .Get "icon" }}
|
||||||
{{ $title := default ($type | title) (.Get "title") }}
|
{{- $title := default ($type | title) (.Get "title") }}
|
||||||
|
|
||||||
|
|
||||||
<blockquote class="gdoc-hint {{ $type | lower }}">
|
<blockquote class="gdoc-hint {{ $type | lower }}">
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{{- $value := default 0 (.Get "value") -}}
|
{{- $value := default 0 (.Get "value") -}}
|
||||||
|
{{- $type := default "main" (.Get "type") }}
|
||||||
{{- $title := .Get "title" -}}
|
{{- $title := .Get "title" -}}
|
||||||
{{- $icon := .Get "icon" -}}
|
{{- $icon := .Get "icon" -}}
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="gdoc-progress__wrap">
|
<div class="gdoc-progress__wrap">
|
||||||
<div
|
<div
|
||||||
class="gdoc-progress__bar"
|
class="gdoc-progress__bar {{ $type | lower }}"
|
||||||
data-percent="{{ $value }}"
|
data-percent="{{ $value }}"
|
||||||
style="width: {{ $value }}%;"
|
style="width: {{ $value }}%;"
|
||||||
></div>
|
></div>
|
||||||
|
|
|
@ -95,6 +95,10 @@
|
||||||
filter: saturate(2.5) brightness(0.85);
|
filter: saturate(2.5) brightness(0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gdoc-progress__bar {
|
||||||
|
filter: saturate(0.85) brightness(0.85);
|
||||||
|
}
|
||||||
|
|
||||||
.gdoc-hint,
|
.gdoc-hint,
|
||||||
.admonitionblock {
|
.admonitionblock {
|
||||||
a {
|
a {
|
||||||
|
|
|
@ -281,6 +281,23 @@
|
||||||
transparent
|
transparent
|
||||||
);
|
);
|
||||||
background-size: 2.5em 2.5em;
|
background-size: 2.5em 2.5em;
|
||||||
background-color: defaults.$main-color !important;
|
background-color: defaults.$main-color;
|
||||||
|
|
||||||
|
@each $name, $color in defaults.$hint-colors {
|
||||||
|
&.#{$name} {
|
||||||
|
background-image: linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
#{color.scale($color, $lightness: -20%)} 25%,
|
||||||
|
transparent 25%,
|
||||||
|
transparent 50%,
|
||||||
|
#{color.scale($color, $lightness: -20%)} 50%,
|
||||||
|
#{color.scale($color, $lightness: -20%)} 75%,
|
||||||
|
transparent 75%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
|
||||||
|
background-color: $color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue