Files
hextra_mirror/layouts/_shortcodes/hextra/hero-section.html
2025-08-15 09:09:58 +08:00

21 lines
864 B
HTML

{{- /*
A simple hero section with a heading and optional style.
@param {string} heading The heading level (default: h2).
@param {string} style The style of the heading.
@param {string} content The content of the heading.
@example {{< hextra/hero-section heading="h3" >}}{{< /hextra/hero-section >}}>
*/ -}}
{{- $style := .Get "style" -}}
{{- $heading := int (strings.TrimPrefix "h" (.Get "heading" | default "h2")) -}}
{{- $size := cond (ge $heading 4) "xl" (cond (eq $heading 3) "2xl" "4xl") -}}
<h{{ $heading }}
class="not-prose hx:text-{{ $size }} hx:font-bold hx:leading-none hx:tracking-tighter hx:md:text-3xl hx:py-2 hx:bg-clip-text hx:text-transparent hx:bg-gradient-to-r hx:from-gray-900 hx:to-gray-600 hx:dark:from-gray-100 hx:dark:to-gray-400"
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
>
{{ .Inner | markdownify }}
</h{{ $heading }}>