|
| 1 | +{{- $class := .Get "class" -}} |
| 2 | +{{- $cols := .Get "cols" | default 2 -}} |
| 3 | +{{- $image := .Get "image" -}} |
| 4 | +{{- $imageCard := .Get "imageCard" | default false -}} |
| 5 | +{{- $imageClass := .Get "imageClass" -}} |
| 6 | +{{- $imageLink := .Get "imageLink" -}} |
| 7 | +{{- $imageLinkExternal := hasPrefix $imageLink "http" -}} |
| 8 | +{{- $imageStyle := .Get "imageStyle" -}} |
| 9 | +{{- $imageTitle := .Get "imageTitle" -}} |
| 10 | +{{- $imageWidth := .Get "imageWidth" | default 350 -}} |
| 11 | +{{- $imageHeight := .Get "imageHeight" | default 350 -}} |
| 12 | +{{- $style := .Get "style" -}} |
| 13 | + |
| 14 | +{{- $css := printf "--hextra-feature-grid-cols: %v; %s" $cols $style -}} |
| 15 | +{{- $href := cond (hasPrefix $imageLink "/") ($imageLink | relURL) $imageLink -}} |
| 16 | +{{- if hasPrefix $image "/" -}} |
| 17 | + {{- $image = relURL (strings.TrimPrefix "/" $image) -}} |
| 18 | +{{- end -}} |
| 19 | + |
| 20 | +<div |
| 21 | + class="{{ $class }} hextra-feature-grid hx-grid sm:max-lg:hx-grid-cols-2 max-sm:hx-grid-cols-1 hx-gap-4 hx-w-full not-prose" |
| 22 | + {{ with $css }}style="{{ . | safeCSS }}"{{ end }} |
| 23 | +> |
| 24 | + <div class="hx-w-full"> |
| 25 | + {{ .Inner }} |
| 26 | + </div> |
| 27 | + {{- with $image }} |
| 28 | + <div class="hx-mx-auto"> |
| 29 | + <a |
| 30 | + {{ with $imageLink }}href="{{ $href }}" {{ with $imageLinkExternal }} target="_blank" rel="noreferrer"{{ end }}{{ end }} |
| 31 | + {{ with $imageStyle }}style="{{ . | safeCSS }}"{{ end }} |
| 32 | + class="{{ $imageClass }} {{ if $imageCard }}hextra-feature-card not-prose hx-block hx-relative hx-p-6 hx-overflow-hidden hx-rounded-3xl hx-border hx-border-gray-200 hover:hx-border-gray-300 dark:hx-border-neutral-800 dark:hover:hx-border-neutral-700 before:hx-pointer-events-none before:hx-absolute before:hx-inset-0 before:hx-bg-glass-gradient{{ end }}" |
| 33 | + > |
| 34 | + <img src="{{ $image }}" width="{{ $imageWidth }}" height="{{ $imageHeight }}" {{ with $imageTitle }}alt="{{ $imageTitle }}"{{ end }}/> |
| 35 | + </a> |
| 36 | + </div> |
| 37 | + {{ end -}} |
| 38 | +</div> |
0 commit comments