diff --git a/component-library/components/contact-form/contact-form.bookshop.yml b/component-library/components/contact-form/contact-form.bookshop.yml index 219e4ef..c932ce6 100644 --- a/component-library/components/contact-form/contact-form.bookshop.yml +++ b/component-library/components/contact-form/contact-form.bookshop.yml @@ -20,7 +20,15 @@ blueprint: backdrop: color: subtle: - image: + illustration: + image: + icon: + ratio: + class: + anchor: + mode: + width: + order: last hook: action: form_id: diff --git a/component-library/components/contact-form/contact-form.hugo.html b/component-library/components/contact-form/contact-form.hugo.html index 19bab8d..9030cef 100644 --- a/component-library/components/contact-form/contact-form.hugo.html +++ b/component-library/components/contact-form/contact-form.hugo.html @@ -49,14 +49,34 @@ {{/* Main code */}} {{ $color := "" }} + {{ $raw := "" }} {{ if .contrast }}{{ $color = "white" }}{{ end }} - {{- $raw := partial "assets/section-title.html" (dict - "heading" .heading - "justify" .justify - "class" (printf "pb-%d" $padding.y)) - -}} - {{ $raw = printf "%s%s" $raw (partial .hook (dict "action" .action "form-id" .form_id)) }} + {{ $form := (partial .hook (dict "action" .action "form-id" .form_id)) }} + {{ if .illustration }} + {{/* Embed the form in a horizontal hero with an illustration */}} + {{ $width := sub 12 (.illustration.width | default 6) }} + {{ $raw = partial "assets/hero.html" (dict + "page" page + "raw" (printf `
%s` $padding.y $form) + "heading" (merge .heading (dict "width" $width)) + "illustration" (merge .illustration (dict "width" 12)) + "order" .order + "link-type" (or .link_type (index . "link-type")) + "links" .links + "orientation" "horizontal" + "width" .width + ) + }} + {{ else }} + {{- $raw = partial "assets/section-title.html" (dict + "heading" .heading + "justify" .justify + "class" (printf "pb-%d" $padding.y)) + -}} + {{ $raw = printf "%s%s" $raw $form }} + {{ end }} + {{ if $raw }} {{ partial "utilities/section.html" (dict "component-name" "contact-form" diff --git a/data/structures/hero.yml b/data/structures/hero.yml index 8c769f6..ee3a2c5 100644 --- a/data/structures/hero.yml +++ b/data/structures/hero.yml @@ -24,6 +24,7 @@ arguments: default: 8 fluid: theme: + raw: hook: default: assets/hero-image.html heading-style: diff --git a/layouts/partials/assets/hero.html b/layouts/partials/assets/hero.html index b37055a..3328c4f 100644 --- a/layouts/partials/assets/hero.html +++ b/layouts/partials/assets/hero.html @@ -129,28 +129,27 @@ {{ $title | safeHTML }} {{ else }} {{/* Render horizontal component */}} -
-
- {{ $order1 := "order-1 order-md-0" }} - {{ $order2 := "order-0 order-md-1" }} - {{ if eq $args.order "first" }} - {{ $order1 = "order-1" }} - {{ $order2 = "order-0" }} - {{ end }} +
+ {{ $order1 := "order-1 order-md-0" }} + {{ $order2 := "order-0 order-md-1" }} + {{ if eq $args.order "first" }} + {{ $order1 = "order-1" }} + {{ $order2 = "order-0" }} + {{ end }} - {{ $imgWidth := sub 12 (or $args.heading.width 12) }} - {{ if lt $imgWidth 1 }}{{ $imgWidth = 1 }}{{ end }} + {{ $imgWidth := sub 12 (or $args.heading.width 12) }} + {{ if lt $imgWidth 1 }}{{ $imgWidth = 1 }}{{ end }} -
- {{ $title | safeHTML }} -
- {{ if $illustration }} -
- {{ $illustration | safeHTML }} - {{ $caption | safeHTML }} -
- {{ end }} +
+ {{ $title | safeHTML }} + {{ $args.raw | safeHTML }} +
+ {{ if $illustration }} +
+ {{ $illustration | safeHTML }} + {{ $caption | safeHTML }}
+ {{ end }}
{{ end }} {{ end }}