2024-12-14 23:44:10 +00:00
|
|
|
|
{{- $calloutEmojiDict := dict "info" "ℹ️" "warning" "⚠️" "error" "🚫" -}}
|
|
|
|
|
{{- $type := .Get "type" | default "default" -}}
|
2023-07-27 23:26:07 +01:00
|
|
|
|
{{/* If emoji is not set, use the emoji from dict */}}
|
2024-12-14 23:44:10 +00:00
|
|
|
|
{{- $emoji := .Get "emoji" -}}
|
|
|
|
|
{{- if eq $emoji "" -}}
|
|
|
|
|
{{- $emoji = index $calloutEmojiDict $type -}}
|
|
|
|
|
{{- end -}}
|
2023-10-29 11:19:31 -04:00
|
|
|
|
{{/* Also allow using "icon" */}}
|
2024-12-14 23:44:10 +00:00
|
|
|
|
{{- $icon := .Get "icon" -}}
|
|
|
|
|
{{- $content := .InnerDeindent | markdownify -}}
|
2023-07-27 23:26:07 +01:00
|
|
|
|
|
2025-03-29 12:51:42 +00:00
|
|
|
|
{{- $defaultClass := "hx:border-orange-100 hx:bg-orange-50 hx:text-orange-800 hx:dark:border-orange-400/30 hx:dark:bg-orange-400/20 hx:dark:text-orange-300" -}}
|
|
|
|
|
{{- $infoClass := "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" -}}
|
|
|
|
|
{{- $warningClass := "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" -}}
|
|
|
|
|
{{- $errorClass := "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" -}}
|
2023-07-27 23:26:07 +01:00
|
|
|
|
|
2024-12-14 23:44:10 +00:00
|
|
|
|
{{- $class := cond (eq $type "info") $infoClass (cond (eq $type "warning") $warningClass (cond (eq $type "error") $errorClass $defaultClass)) -}}
|
2023-07-27 23:26:07 +01:00
|
|
|
|
|
2024-12-14 23:44:10 +00:00
|
|
|
|
{{- partial "shortcodes/callout.html" (dict "content" $content "emoji" $emoji "icon" $icon "class" $class) -}}
|