Files
blowfish/layouts/shortcodes/alert.html
T
Khadirullah Mohammad 680b395c4a 🐛 Fix alert overflow when it contains a code block
The alert text span is a flex item with the default min-width: auto,
so it cannot shrink below its widest child. A code block or table in
an alert ran past the alert box, and on phones made the page wider
than the screen.

Add min-w-0 to the text span in both the default and textColor
branches so wide content scrolls inside the alert.
2026-10-13 14:39:00 +05:30

38 lines
1.1 KiB
HTML

{{ if .IsNamedParams }}
{{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get "icon") ) }}
{{ $.Scratch.Set "cardColor" (.Get "cardColor") }}
{{ $.Scratch.Set "iconColor" (.Get "iconColor") }}
{{ $.Scratch.Set "textColor" (.Get "textColor") }}
{{ else }}
{{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get 0) ) }}
{{ end }}
<div
{{ if not ($.Scratch.Get "cardColor") }}
class="flex px-4 py-3 rounded-md shadow bg-primary-100 dark:bg-primary-900"
{{ else }}
class="flex px-4 py-3 rounded-md shadow" style="background-color: {{ $.Scratch.Get "cardColor" }}"
{{ end }}
>
<span
{{ if not ($.Scratch.Get "iconColor") }}
class="text-primary-400 pe-3 flex items-center"
{{ else }}
class="pe-3 flex items-center" style="color: {{ $.Scratch.Get "iconColor" }}"
{{ end }}
>
{{ partial "icon.html" ($.Scratch.Get "icon") }}
</span>
<span
{{ if not ($.Scratch.Get "textColor") }}
class="min-w-0 dark:text-neutral-300"
{{ else }}
class="min-w-0" style="color: {{ $.Scratch.Get "textColor" }}"
{{ end }}
>
{{- .Inner | markdownify -}}
</span>
</div>