Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions component-library/bookshop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@import "modules/bookshop/components/cta/cta";
@import "modules/bookshop/components/faq/faq";
@import "modules/bookshop/components/featured/featured";
@import "modules/bookshop/components/heading/heading";
@import "modules/bookshop/components/hero/hero";
@import "modules/bookshop/components/list/list";
@import "modules/bookshop/components/menu/menu";
Expand Down
33 changes: 33 additions & 0 deletions component-library/components/heading/heading.bookshop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Metadata about this component, to be used in the CMS
spec:
structures:
- content_blocks
label: Heading
description: Show a section heading with regular content
icon: title
tags: []

# Defines the structure of this component, as well as the default values
blueprint:
heading:
preheading:
title:
content:
align: start
arrangement:
width:
size:
background:
backdrop:
color:
subtle:
class:
width:
justify: start
wrapper:
fluid:
theme:
cover:
overlay_mode:
section_class:
bg_class:
62 changes: 62 additions & 0 deletions component-library/components/heading/heading.hugo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Copyright © 2026 The Hinode Team / Mark Dumay. All rights reserved.
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
Visit gethinode.com/license for more details.

Note: To support live editing, bookshop components should use a clear path to the provided arguments.
Therefore, we cannot use the InitArgs partial at this point, and we need to access each argument
directly. See the docs for more background:
https://github.com/CloudCannon/bookshop/blob/main/guides/hugo.adoc#passing-data-to-bookshop-components
*/}}

{{/* Validate arguments */}}
{{ $error := false }}
{{ if not site.Params.env_bookshop_live }}
{{ $args := partial "utilities/InitArgs.html" (dict "bookshop" "heading" "args" .) }}
{{ if or $args.err $args.warnmsg }}
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
"partial" "component-library/components/heading/heading.hugo.html"
"warnid" "warn-invalid-arguments"
"msg" "Invalid arguments"
"details" ($args.errmsg | append $args.warnmsg)
"file" page.File
)}}
{{ $error = $args.err }}
{{- end -}}
{{- end -}}

{{ if not $error }}
{{/* Initialize global arguments */}}
{{- $padding := partial "utilities/GetPadding.html" -}}

{{/* Capture common class settting */}}
{{ $settings := dict }}
{{ if reflect.IsMap site.Params.modules.blocks }}
{{ $settings = index site.Params.modules.blocks "heading" }}
{{ end }}
{{ $class := index $settings "class" | default "" }}

{{/* Main code */}}
{{- $raw := partial "assets/section-title.html" (dict
"heading" .heading
"justify" .justify)
-}}

{{ if $raw }}
{{ partial "utilities/section.html" (dict
"component-name" "heading"
"id" .id
"raw" $raw
"background" .background
"width" .width
"justify" .justify
"wrapper" .wrapper
"fluid" .fluid
"theme" .theme
"cover" .cover
"overlay-mode" (or .overlay_mode (index . "overlay-mode"))
"section-class" (or .section_class (index . "section-class"))
"bg-class" (or .bg_class (index . "bg-class"))
)}}
{{ end }}
{{ end }}
1 change: 1 addition & 0 deletions component-library/components/heading/heading.hugo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- No content besides heading itself -->
Empty file.
7 changes: 7 additions & 0 deletions component-library/components/heading/heading.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
comment: >-
Renders a section heading with optional regular content.
example: |
heading:
preheading: Preheading
title: Section heading
content: Regular content that is placed below the title.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ spec:
tags: []

blueprint:
clear:
section_class:
bg_class:
14 changes: 13 additions & 1 deletion component-library/components/separator/separator.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

{{/* Validate arguments */}}
{{ $error := false }}
{{ $id := .id }}
{{ $clear := .clear }}
{{ $class := .section_class }}
{{ if not site.Params.env_bookshop_live }}
{{ $args := partial "utilities/InitArgs.html" (dict "bookshop" "separator" "args" .) }}
{{ if or $args.err $args.warnmsg }}
Expand All @@ -17,9 +20,18 @@
"file" page.File
)}}
{{ $error = $args.err }}
{{ else }}
{{ $id = $args.id }}
{{ $clear = $args.clear }}
{{ $class = $args.section_class }}
{{- end -}}
{{- end -}}

{{ if not $error }}
<hr class="container-xxl width-100">
{{ if $clear }}
{{- $padding := partial "utilities/GetPadding.html" -}}
<div {{ with $id }}id="{{ . }}"{{ end }} class="clear-separator container-xxl pt-{{ $padding.y}} width-100 {{ $class }}"></div>
{{ else }}
<hr {{ with $id }}id="{{ . }}"{{ end }} class="separator container-xxl width-100 {{ $class }}">
{{ end }}
{{ end }}
3 changes: 3 additions & 0 deletions component-library/components/separator/separator.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.clear-separator {
border: none;
}
4 changes: 2 additions & 2 deletions exampleSite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.19

require (
github.com/cloudcannon/bookshop/hugo/v3 v3.18.2 // indirect
github.com/gethinode/mod-blocks v1.15.2 // indirect
github.com/gethinode/mod-utils/v5 v5.19.1 // indirect
github.com/gethinode/mod-blocks v1.15.3 // indirect
github.com/gethinode/mod-utils/v5 v5.20.0 // indirect
)
4 changes: 4 additions & 0 deletions exampleSite/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ github.com/gethinode/mod-blocks v1.15.1 h1:gKUclJD+yUhsrLRr5uheOJ2MMLK2EuAAZFZI6
github.com/gethinode/mod-blocks v1.15.1/go.mod h1:A9WagW9TCZxv/VsVF92CATjfxeVDKBrhF1n33IV9250=
github.com/gethinode/mod-blocks v1.15.2 h1:Sx1HdveBvJuQlTw1rfKwW4nkVZfJuien+6CykLGvo90=
github.com/gethinode/mod-blocks v1.15.2/go.mod h1:iG/4tXktwqgUyzHyRbuAHmGsdQwmEhUG/YkufNcUe+k=
github.com/gethinode/mod-blocks v1.15.3 h1:GORSj6ehAGuOTBKvXSGiy8EuCx5hnbEJvgVoW4gIDEg=
github.com/gethinode/mod-blocks v1.15.3/go.mod h1:jX1qXECc+RNBiGE9lOhc+5QE7JvCBWL1m/dzY2F6Dx4=
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=
github.com/gethinode/mod-utils/v5 v5.11.0 h1:1BO9uK0zecHF6dNJcqX8NFNHSIdizlyj88n9ylLUsDc=
Expand Down Expand Up @@ -84,3 +86,5 @@ github.com/gethinode/mod-utils/v5 v5.19.0 h1:fX3gTsYoimUNqD/KeBsyBrrJ2DygQ0M7Rc8
github.com/gethinode/mod-utils/v5 v5.19.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=
github.com/gethinode/mod-utils/v5 v5.19.1 h1:peyYRxjIf8d84mt435veKaiO5nrIBXQ5xrHKHqcJehw=
github.com/gethinode/mod-utils/v5 v5.19.1/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=
github.com/gethinode/mod-utils/v5 v5.20.0 h1:K+oBv8kJ4pVj4m1HlxgJiC+DYNX4oumqS6Cvcp2C8Ho=
github.com/gethinode/mod-utils/v5 v5.20.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.19

require (
github.com/cloudcannon/bookshop/hugo/v3 v3.18.2 // indirect
github.com/gethinode/mod-utils/v5 v5.19.1 // indirect
github.com/gethinode/mod-utils/v5 v5.20.0 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ github.com/gethinode/mod-utils/v5 v5.19.0 h1:fX3gTsYoimUNqD/KeBsyBrrJ2DygQ0M7Rc8
github.com/gethinode/mod-utils/v5 v5.19.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=
github.com/gethinode/mod-utils/v5 v5.19.1 h1:peyYRxjIf8d84mt435veKaiO5nrIBXQ5xrHKHqcJehw=
github.com/gethinode/mod-utils/v5 v5.19.1/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=
github.com/gethinode/mod-utils/v5 v5.20.0 h1:K+oBv8kJ4pVj4m1HlxgJiC+DYNX4oumqS6Cvcp2C8Ho=
github.com/gethinode/mod-utils/v5 v5.20.0/go.mod h1:PwQN4oOjA6k/vet11JueJ9asZMgL0DBa3jyS9tPkBWU=