diff --git a/component-library/components/cta/cta.hugo.html b/component-library/components/cta/cta.hugo.html index 62af951..10e5020 100644 --- a/component-library/components/cta/cta.hugo.html +++ b/component-library/components/cta/cta.hugo.html @@ -10,7 +10,7 @@ */}} {{/* Main code */}} -{{- $ctaAction := site.Params.icons.ctaAction | default "fas chevron-right" -}} +{{- $ctaAction := partial "utilities/GetThemeIcon.html" (dict "id" "ctaAction" "default" "fas chevron-right") -}} {{ $links := slice }} {{ if and (reflect.IsSlice .links) (gt (len .links) 0) }} {{ $links = .links }} diff --git a/component-library/components/testimonials/testimonials.bookshop.yml b/component-library/components/testimonials/testimonials.bookshop.yml index 5bd3339..9716f19 100644 --- a/component-library/components/testimonials/testimonials.bookshop.yml +++ b/component-library/components/testimonials/testimonials.bookshop.yml @@ -19,7 +19,6 @@ blueprint: testimonials: - logo: icon: - scale: content: client: name: diff --git a/config.toml b/config.toml index 054e910..71339c7 100644 --- a/config.toml +++ b/config.toml @@ -51,6 +51,10 @@ [[module.imports]] path = "github.com/cloudcannon/bookshop/hugo/v3" + # Import common Hinode utitilies + [[module.imports]] + path = "github.com/gethinode/mod-utils/v5" + # Icon defaults for mod-blocks components [params.icons] # Testimonial carousel controls diff --git a/data/structures/testimonial-carousel.yml b/data/structures/testimonial-carousel.yml index ea814c7..00c7e9f 100644 --- a/data/structures/testimonial-carousel.yml +++ b/data/structures/testimonial-carousel.yml @@ -6,7 +6,6 @@ arguments: testimonials: - logo: icon: - scale: content: client: name: diff --git a/data/structures/testimonial.yml b/data/structures/testimonial.yml deleted file mode 100644 index 1f53477..0000000 --- a/data/structures/testimonial.yml +++ /dev/null @@ -1,37 +0,0 @@ -comment: Displays a single testimonial card. -arguments: - page: - content: - type: - - string - - template.HTML - optional: true - comment: Quote to include in the testimonial. - group: partial - color: - contact: - role: - url: - image: - logo: - icon: - icon-style: - default: fa-5x - release: v2.0.0 - scale: - release: v2.0.0 - padding: - orientation: - show-controls: - type: bool - optional: true - default: false - comment: >- - Trigger to add margins for carousel controls. If set, - the card includes a quote icon on the right-hand side too. - class: - link: -body: - optional: false - comment: Quote to include in the testimonial. - group: shortcode diff --git a/exampleSite/go.mod b/exampleSite/go.mod index 0e64800..8f78ee3 100644 --- a/exampleSite/go.mod +++ b/exampleSite/go.mod @@ -5,4 +5,5 @@ go 1.19 require ( github.com/cloudcannon/bookshop/hugo/v3 v3.17.1 // indirect github.com/gethinode/mod-blocks v1.3.1 // indirect + github.com/gethinode/mod-utils/v5 v5.10.0 // indirect ) diff --git a/exampleSite/go.sum b/exampleSite/go.sum index bfd5cd6..0e9e482 100644 --- a/exampleSite/go.sum +++ b/exampleSite/go.sum @@ -10,3 +10,5 @@ github.com/gethinode/mod-blocks v1.3.0 h1:Aj0kIIOFDHU83F4r7zfO54YatHr56KxWosPomA github.com/gethinode/mod-blocks v1.3.0/go.mod h1:H3Slh4BaxmYLX61YXyO/yqMZHlCwSlvX3VekDpnWCSM= github.com/gethinode/mod-blocks v1.3.1 h1:LuwUVSgBrXQ6jBIoNPt730HA8TMJQVNIDxwKIgWTimo= github.com/gethinode/mod-blocks v1.3.1/go.mod h1:H3Slh4BaxmYLX61YXyO/yqMZHlCwSlvX3VekDpnWCSM= +github.com/gethinode/mod-utils/v5 v5.10.0 h1:NlofAfa1YILV9pwS8vMkEwVUdrnKCoIlVwJPm3+UVGs= +github.com/gethinode/mod-utils/v5 v5.10.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU= diff --git a/go.mod b/go.mod index 43df170..3faa76a 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module github.com/gethinode/mod-blocks go 1.19 -require github.com/cloudcannon/bookshop/hugo/v3 v3.17.1 // indirect +require ( + github.com/cloudcannon/bookshop/hugo/v3 v3.17.1 // indirect + github.com/gethinode/mod-utils/v5 v5.10.0 // indirect +) diff --git a/go.sum b/go.sum index f85d6c2..9dd5aa3 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ github.com/cloudcannon/bookshop/hugo/v3 v3.17.1 h1:weTVWBamjQHMIp/oYTFsPwRzzhWrZA6JO43QnxI1kxw= github.com/cloudcannon/bookshop/hugo/v3 v3.17.1/go.mod h1:s7mIonDhtsLcn10ZKuVXyqd6BDHI8vT1WQhZw8rPfY8= +github.com/gethinode/mod-utils/v5 v5.10.0 h1:NlofAfa1YILV9pwS8vMkEwVUdrnKCoIlVwJPm3+UVGs= +github.com/gethinode/mod-utils/v5 v5.10.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU= diff --git a/layouts/partials/assets/hero.html b/layouts/partials/assets/hero.html index f75a7be..55b560c 100644 --- a/layouts/partials/assets/hero.html +++ b/layouts/partials/assets/hero.html @@ -29,7 +29,7 @@ {{ $scale := "" }} {{ $icon := "" }} {{ with $args.illustration }} - {{ $scale = .scale }} + {{ $scale = .width }} {{ $icon = .icon }} {{ end }} {{ $heading := cond (eq $args.orientation "horizontal") (merge $args.heading (dict "width" 12)) $args.heading }} diff --git a/layouts/partials/assets/preview.html b/layouts/partials/assets/preview.html index 3f1c080..9888604 100644 --- a/layouts/partials/assets/preview.html +++ b/layouts/partials/assets/preview.html @@ -21,12 +21,11 @@ {{/* Initialize global variables */}} {{- $padding := partial "utilities/GetPadding.html" -}} -{{- $deviceIcons := dict - "desktop" (site.Params.icons.previewDesktop | default "fas fa-desktop") - "tablet" (site.Params.icons.previewTablet | default "fas fa-tablet-alt") - "mobile" (site.Params.icons.previewMobile | default "fas fa-mobile-alt") --}} -{{- $previewError := site.Params.icons.previewError | default "fas fa-exclamation-triangle" -}} +{{- $previewDesktop := partial "utilities/GetThemeIcon.html" (dict "id" "previewDesktop" "default" "fas desktop") -}} +{{- $previewTablet := partial "utilities/GetThemeIcon.html" (dict "id" "previewTablet" "default" "fas tablet-alt") -}} +{{- $previewMobile := partial "utilities/GetThemeIcon.html" (dict "id" "previewMobile" "default" "fas mobile-alt") -}} +{{- $previewError := partial "utilities/GetThemeIcon.html" (dict "id" "previewError" "default" "fas exclamation-triangle") -}} +{{- $deviceIcons := dict "desktop" $previewDesktop "tablet" $previewTablet "mobile" $previewMobile -}} {{/* Initialize local variables */}} {{- $devices := slice "desktop" "tablet" "mobile" -}} diff --git a/layouts/partials/assets/testimonial-carousel.html b/layouts/partials/assets/testimonial-carousel.html index 9dc512e..66a5af3 100644 --- a/layouts/partials/assets/testimonial-carousel.html +++ b/layouts/partials/assets/testimonial-carousel.html @@ -22,8 +22,8 @@ {{/* Initialize global variables */}} {{- $breakpoint := partial "utilities/GetBreakpoint.html" -}} {{- $padding := partial "utilities/GetPadding.html" -}} -{{- $carouselPrev := site.Params.icons.carouselPrev | default "fas chevron-left" -}} -{{- $carouselNext := site.Params.icons.carouselNext | default "fas chevron-right" -}} +{{- $carouselPrev := partial "utilities/GetThemeIcon.html" (dict "id" "carouselPrev" "default" "fas chevron-left") -}} +{{- $carouselNext := partial "utilities/GetThemeIcon.html" (dict "id" "carouselNext" "default" "fas chevron-right") -}} {{/* Initialize local variables */}} {{ $colGrid := printf "row-cols-%d" ($args.cols | default 1) }} @@ -65,7 +65,6 @@ "logo" $item.logo "icon" $item.icon "icon-style" $args.iconStyle - "scale" $item.scale "contact" (cond ($item.client | not | not) $item.client.contact "") "role" (cond ($item.client | not | not) $item.client.role "") "image" (cond ($item.client | not | not) $item.client.image "") @@ -98,7 +97,6 @@ "logo" .logo "icon" .icon "icon-style" $args.iconStyle - "scale" .scale "contact" (cond (.client | not | not) .client.contact "") "role" (cond (.client | not | not) .client.role "") "image" (cond (.client | not | not) .client.image "") diff --git a/layouts/partials/page/contact.html b/layouts/partials/page/contact.html index ab77a09..da75245 100644 --- a/layouts/partials/page/contact.html +++ b/layouts/partials/page/contact.html @@ -3,7 +3,7 @@ {{- $orientation := .orientation -}} {{- $align := .align | default "start" }} {{- $title := .title | default (T "contactHeaderTopic") }} -{{- $ctaAction := site.Params.icons.ctaAction | default "fas chevron-right" -}} +{{- $ctaAction := partial "utilities/GetThemeIcon.html" (dict "id" "ctaAction" "default" "fas chevron-right") -}} {{- with $contact -}} {{- $link := "" -}}