From 095a64b1507c170124d303f751fd291acb98b30c Mon Sep 17 00:00:00 2001 From: Mircea-Pavel ANTON Date: Fri, 27 Jan 2023 23:07:45 +0000 Subject: [PATCH] Update shortcode --- layouts/shortcodes/alert.html | 51 ++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/layouts/shortcodes/alert.html b/layouts/shortcodes/alert.html index ef343828..cae61671 100644 --- a/layouts/shortcodes/alert.html +++ b/layouts/shortcodes/alert.html @@ -1,27 +1,42 @@ -{{ $icon := default "triangle-exclamation" (.Get "icon") }} -{{ $cardColor := default "NULL" (.Get "cardColor") }} -{{ $iconColor := default "NULL" (.Get "iconColor") }} -{{ $textColor := default "NULL" (.Get "textColor") }} - -{{ if eq $cardColor "NULL" }} -
+{{ if .IsNamedParams }} + {{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get "icon") ) }} + {{ $.Scratch.Set "cardColor" (default "NULL" (.Get "cardColor") ) }} + {{ $.Scratch.Set "iconColor" (default "NULL" (.Get "iconColor") ) }} + {{ $.Scratch.Set "textColor" (default "NULL" (.Get "textColor") ) }} {{ else }} -
+ {{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get 0) ) }} + {{ $.Scratch.Set "cardColor" "NULL" }} + {{ $.Scratch.Set "iconColor" "NULL" }} + {{ $.Scratch.Set "textColor" "NULL" }} {{ end }} - {{ if eq $iconColor "NULL" }} - + +
- {{ end }} - {{ partial "icon.html" $icon }} + class="flex px-4 py-3 rounded-md" + style="background-color: {{ $.Scratch.Get "cardColor" }}" + {{ end }}> + + + + {{ partial "icon.html" ($.Scratch.Get "icon") }} - {{ if eq $textColor "NULL" }} - - {{ else }} - - {{ end }} + + {{- .Inner | markdownify -}}