mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 17:46:38 -04:00
23 lines
1.3 KiB
HTML
23 lines
1.3 KiB
HTML
{{- $content := .content -}}
|
|
{{- $type := .type | default "" -}}
|
|
{{- $class := .class | default "" -}}
|
|
{{- $border := .border | default false -}}
|
|
{{- $icon := .icon | default "" -}}
|
|
|
|
{{- $defaultClass := "hx:text-gray-600 hx:bg-gray-100 hx:dark:bg-neutral-800 hx:dark:text-neutral-200 hx:border-gray-200 hx:dark:border-neutral-700" -}}
|
|
|
|
{{- $styleClass := newScratch -}}
|
|
{{- $styleClass.Set "info" "hx:border-blue-200 hx:bg-blue-100 hx:text-blue-900 hx:dark:border-blue-200/30 hx:dark:bg-blue-900/30 hx:dark:text-blue-200" -}}
|
|
{{- $styleClass.Set "warning" "hx:border-yellow-100 hx:bg-yellow-50 hx:text-yellow-900 hx:dark:border-yellow-200/30 hx:dark:bg-yellow-700/30 hx:dark:text-yellow-200" -}}
|
|
{{- $styleClass.Set "error" "hx:border-red-200 hx:bg-red-100 hx:text-red-900 hx:dark:border-red-200/30 hx:dark:bg-red-900/30 hx:dark:text-red-200" -}}
|
|
|
|
{{- $borderClass := cond (eq $border true) "hx:border" "" -}}
|
|
{{- $badgeClass := or ($styleClass.Get $type) $defaultClass -}}
|
|
<div class="hextra-badge {{ $class }}">
|
|
<div class="hx:inline-flex hx:gap-1 hx:items-center hx:rounded-full hx:px-2.5 hx:leading-6 hx:text-[.65rem] {{ $borderClass }} {{ $badgeClass }}">
|
|
{{- with $icon -}}{{- partial "utils/icon" (dict "name" . "attributes" "height=12") -}}{{- end -}}
|
|
{{- $content -}}
|
|
</div>
|
|
</div>
|
|
{{- /* Strip trailing newline. */ -}}
|