mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
notice: streamline icon parameter with button shortcode #240
This commit is contained in:
parent
4b79d36155
commit
5d2403a067
2 changed files with 8 additions and 5 deletions
|
@ -39,8 +39,8 @@ It is all about the boxes.
|
|||
| Name | Position | Optional | Default | Notes |
|
||||
|:----------|:---------|:----------|:----------|:------------|
|
||||
| **style** | 1 | yes | `default` | The color scheme used to highlight the box content.<br/><br/>- by severity: `info`, `note`, `tip`, `warning`<br/>- by brand color: `primary`, `secondary`<br/>- by color: `blue`, `green`, `grey`, `orange`, `red`<br/>- by special color: `default`, `transparent` |
|
||||
| **title** | 2 | yes | see notes | Arbitray text for the box title. Depending on the **style** there may be a default title. Any given value will overwrite the default.<br/><br/>- for severity styles: the matching title for the severity<br/>- for all other colors: no title<br/><br/>If you want no title for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
| **icon** | 3 | yes | see notes | [Font Awesome icon name]({{%relref "cont/icons#finding-an-icon" %}}) set to the left of the title. Depending on the **style** there may be a default icon. Any given value will overwrite the default.<br/><br/>- for severity styles: a nice matching icon for the severity<br/>- for all other colors: no icon<br/><br/>If you want no icon for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
| **title** | 2 | yes | see notes | Arbitray text for the box title. Depending on the **style** there may be a default title. Any given value will overwrite the default.<br/><br/>- for severity styles: the matching title for the severity<br/>- for all other colors: _<empty>_<br/><br/>If you want no title for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
| **icon** | 3 | yes | see notes | [Font Awesome icon name]({{%relref "cont/icons#finding-an-icon" %}}) set to the left of the title. Depending on the **style** there may be a default icon. Any given value will overwrite the default.<br/><br/>- for severity styles: a nice matching icon for the severity<br/>- for all other colors: _<empty>_<br/><br/>If you want no icon for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -6,11 +6,14 @@
|
|||
{{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }}
|
||||
{{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }}
|
||||
{{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }}
|
||||
{{- if eq $style "tip" }}{{ $icon = default "lightbulb " }}{{ end }}
|
||||
{{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
|
||||
{{- end }}
|
||||
{{- $icon = trim $icon " " }}
|
||||
<div class="box notices {{ $style }}">
|
||||
<div class="box-label">{{ if $icon }}<i class="fas fa-{{ $icon }} fa-fw"></i> {{ end }}{{ $title }}</div>
|
||||
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
|
||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||
{{- end }}
|
||||
<div class="box notices cstyle {{ $style }}">
|
||||
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i> {{ end }}{{ $title }}</div>
|
||||
<div class="box-content">
|
||||
{{ .Inner }} </div>
|
||||
</div>
|
Loading…
Reference in a new issue