mirror of
https://github.com/imfing/hextra.git
synced 2025-08-25 00:36:36 -04:00
feat(badges): colors and border (#774)
* feat(badges): add more colors and allow to disable the border * feat(badges): more colors * chore: generate * docs: add Others inside the sidebar * chore: i18n --------- Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
7b8e1bdfd1
commit
22c1a4f9df
@@ -2,7 +2,7 @@
|
||||
A shortcode to create a badge.
|
||||
|
||||
@param {string} content The content of the badge.
|
||||
@param {string} type The type of the badge.
|
||||
@param {string} color The color of the badge.
|
||||
@param {string} class The class of the badge.
|
||||
@param {string} link The link of the badge.
|
||||
@param {string} icon The icon of the badge.
|
||||
@@ -11,23 +11,25 @@ or
|
||||
|
||||
@param {string} 0 The content of the badge.
|
||||
|
||||
@example {{< badge content="info" type="info" >}}
|
||||
@example {{< badge content="Badge" color="blue" >}}
|
||||
@example {{< badge "Badge" >}}
|
||||
*/ -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $content := .Get "content" -}}
|
||||
{{- $type := .Get "type" | default "" -}}
|
||||
{{- $color := .Get "color" | default (.Get "type") | default "" -}}{{- /* Compatibility with previous parameter. */ -}}
|
||||
{{- $class := .Get "class" | default "" -}}
|
||||
{{- $link := .Get "link" | default "" -}}
|
||||
{{- $icon := .Get "icon" | default "" -}}
|
||||
{{- $border := not (eq (.Get "border") false) | default true }}
|
||||
|
||||
{{- if $link -}}
|
||||
<a href="{{ $link }}" title="{{ $content | plainify }}" target="_blank">
|
||||
{{- partial "shortcodes/badge.html" (dict
|
||||
"content" $content
|
||||
"type" $type
|
||||
"color" $color
|
||||
"class" $class
|
||||
"border" true
|
||||
"border" $border
|
||||
"icon" $icon
|
||||
)
|
||||
-}}
|
||||
@@ -35,9 +37,9 @@ or
|
||||
{{- else -}}
|
||||
{{- partial "shortcodes/badge.html" (dict
|
||||
"content" $content
|
||||
"type" $type
|
||||
"color" $color
|
||||
"class" $class
|
||||
"border" true
|
||||
"border" $border
|
||||
"icon" $icon
|
||||
)
|
||||
-}}
|
||||
|
@@ -6,7 +6,7 @@ A shortcode to create a card.
|
||||
@param {string} icon The icon of the card.
|
||||
@param {string} subtitle The subtitle of the card.
|
||||
@param {string} tag The tag of the card.
|
||||
@param {string} tagType The type of the tag.
|
||||
@param {string} tagColor The color of the tag.
|
||||
@param {string} image The image of the card.
|
||||
@param {string} method The method to process the image.
|
||||
@param {string} options The options to process the image.
|
||||
@@ -24,7 +24,7 @@ A shortcode to create a card.
|
||||
{{- $height := 0 -}}
|
||||
{{- $imageStyle := .Get "imageStyle" -}}
|
||||
{{- $tag := .Get "tag" -}}
|
||||
{{- $tagType := .Get "tagType" -}}
|
||||
{{- $tagColor := .Get "tagColor" | default (.Get "tagType") | default "" -}}{{- /* Compatibility with previous parameter. */ -}}
|
||||
|
||||
{{/* Image processing options */}}
|
||||
{{- $method := .Get "method" | default "Resize" | humanize -}}
|
||||
@@ -60,6 +60,6 @@ A shortcode to create a card.
|
||||
"height" $height
|
||||
"imageStyle" $imageStyle
|
||||
"tag" $tag
|
||||
"tagType" $tagType
|
||||
"tagType" $tagColor
|
||||
)
|
||||
-}}
|
||||
|
Reference in New Issue
Block a user