From d43ac6649463e563838d1ca71d1afd701193378f Mon Sep 17 00:00:00 2001 From: Floren Munteanu Date: Thu, 23 May 2024 18:36:46 -0400 Subject: [PATCH] feat: add hextra hero-container shortcode (#389) * Implement hextra hero-container * Fix width * Fix width * Fix width * Set number of columns * Fix display for mobile devices * Trim image prefix * Implement image card * Fix width * Fix css --- layouts/shortcodes/hextra/hero-container.html | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 layouts/shortcodes/hextra/hero-container.html diff --git a/layouts/shortcodes/hextra/hero-container.html b/layouts/shortcodes/hextra/hero-container.html new file mode 100644 index 0000000..1b7e54c --- /dev/null +++ b/layouts/shortcodes/hextra/hero-container.html @@ -0,0 +1,38 @@ +{{- $class := .Get "class" -}} +{{- $cols := .Get "cols" | default 2 -}} +{{- $image := .Get "image" -}} +{{- $imageCard := .Get "imageCard" | default false -}} +{{- $imageClass := .Get "imageClass" -}} +{{- $imageLink := .Get "imageLink" -}} +{{- $imageLinkExternal := hasPrefix $imageLink "http" -}} +{{- $imageStyle := .Get "imageStyle" -}} +{{- $imageTitle := .Get "imageTitle" -}} +{{- $imageWidth := .Get "imageWidth" | default 350 -}} +{{- $imageHeight := .Get "imageHeight" | default 350 -}} +{{- $style := .Get "style" -}} + +{{- $css := printf "--hextra-feature-grid-cols: %v; %s" $cols $style -}} +{{- $href := cond (hasPrefix $imageLink "/") ($imageLink | relURL) $imageLink -}} +{{- if hasPrefix $image "/" -}} + {{- $image = relURL (strings.TrimPrefix "/" $image) -}} +{{- end -}} + +
+
+ {{ .Inner }} +
+ {{- with $image }} +
+ + + +
+ {{ end -}} +