-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: move badge to a separate partial * feat: badge shortcode * docs: add badge shortcode examples * chore: generate css * docs: add spaces between badges
- Loading branch information
Showing
9 changed files
with
104 additions
and
12 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
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,3 @@ | ||
.hextra-badge { | ||
@apply hx-inline-flex hx-items-center; | ||
} |
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 |
---|---|---|
|
@@ -38,5 +38,4 @@ | |
top: 5px; | ||
right: 5px; | ||
z-index: 10; | ||
font-size: .65rem; | ||
} |
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
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
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
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,16 @@ | ||
{{- $content := .content -}} | ||
{{- $type := .type -}} | ||
{{- $class := .class | default "" -}} | ||
{{- $border := .border | default false -}} | ||
|
||
{{- $defaultClass := "hx-text-gray-600 hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200 hx-border-gray-200 dark:hx-border-neutral-700" -}} | ||
{{- $warningClass := "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" -}} | ||
{{- $infoClass := "hx-border-blue-200 hx-bg-blue-100 hx-text-blue-900 dark:hx-border-blue-200/30 dark:hx-bg-blue-900/30 dark:hx-text-blue-200" -}} | ||
{{- $errorClass := "hx-border-red-200 hx-bg-red-100 hx-text-red-900 dark:hx-border-red-200/30 dark:hx-bg-red-900/30 dark:hx-text-red-200" -}} | ||
|
||
{{- $borderClass := cond (eq $border true) "hx-border" "" -}} | ||
{{- $badgeClass := cond (eq $type "info") $infoClass (cond (eq $type "warning") $warningClass (cond (eq $type "error") $errorClass $defaultClass)) -}} | ||
<div class="hextra-badge {{ $class }}"> | ||
<div class="hx-inline-flex hx-items-center hx-rounded-full hx-px-2.5 hx-leading-6 hx-text-[.65rem] {{ $borderClass }} {{ $badgeClass }}">{{- $content -}}</div> | ||
</div> | ||
{{- /* Strip trailing newline. */ -}} |
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
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,33 @@ | ||
{{- if .IsNamedParams -}} | ||
{{- $content := .Get "content" -}} | ||
{{- $type := .Get "type" | default "" -}} | ||
{{- $class := .Get "class" | default "" -}} | ||
{{- $link := .Get "link" | default "" -}} | ||
|
||
{{- if $link -}} | ||
<a href="{{ $link }}" title="{{ $content | plainify }}" target="_blank"> | ||
{{- partial "shortcodes/badge.html" (dict | ||
"content" $content | ||
"type" $type | ||
"class" $class | ||
"border" true | ||
) | ||
-}} | ||
</a> | ||
{{- else -}} | ||
{{- partial "shortcodes/badge.html" (dict | ||
"content" $content | ||
"type" $type | ||
"class" $class | ||
"border" true | ||
) | ||
-}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- $content := .Get 0 -}} | ||
{{- partial "shortcodes/badge.html" (dict | ||
"content" $content | ||
"border" true | ||
) | ||
-}} | ||
{{- end -}} |