Skip to content

Commit a855a41

Browse files
authored
Merge branch 'main' into hugo-mod-dependencies
2 parents dc1c358 + c41cd06 commit a855a41

File tree

18 files changed

+715
-126
lines changed

18 files changed

+715
-126
lines changed

assets/js/nav.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function updateDropdown (element, id, label) {
2+
const dropdown = document.getElementById(element)
3+
if (dropdown != null) {
4+
dropdown.querySelector('.dropdown-toggle').textContent = label
5+
dropdown.querySelectorAll('.panel-dropdown .dropdown-item').forEach(item => {
6+
item.classList.remove('active')
7+
let target = item.getAttribute('data-link')
8+
if (target != null) {
9+
target = target.replace(/^#+/, '')
10+
if (target === id) {
11+
item.classList.add('active')
12+
}
13+
}
14+
})
15+
}
16+
}
17+
18+
document.querySelectorAll('.panel-dropdown').forEach(trigger => {
19+
trigger.addEventListener('hide.bs.dropdown', event => {
20+
if (event.clickEvent != null) {
21+
let target = event.clickEvent.srcElement.getAttribute('data-link')
22+
if (target != null) {
23+
trigger.querySelectorAll('.panel-dropdown .dropdown-item').forEach(item => {
24+
item.classList.remove('active')
25+
})
26+
target = target.replace(/^#+/, '')
27+
const btn = document.getElementById(target)
28+
if (btn != null) {
29+
event.clickEvent.srcElement.classList.add('active')
30+
trigger.querySelector('.dropdown-toggle').textContent = event.clickEvent.srcElement.textContent
31+
btn.click()
32+
}
33+
}
34+
}
35+
})
36+
})
37+
38+
document.querySelectorAll('.nav-panel .nav-link').forEach(trigger => {
39+
trigger.addEventListener('click', event => {
40+
const companion = event.srcElement.parentElement.parentElement.getAttribute('data-companion')
41+
if (companion != null) {
42+
updateDropdown(companion, trigger.getAttribute('id'), trigger.textContent.trim())
43+
}
44+
})
45+
})

component-library/bookshop.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@import "modules/bookshop/components/cta/cta";
66
@import "modules/bookshop/components/faq/faq";
77
@import "modules/bookshop/components/hero/hero";
8+
@import "modules/bookshop/components/panels/panels";
89
@import "modules/bookshop/components/releases/releases";
910
@import "modules/bookshop/components/separator/separator";
1011
@import "modules/bookshop/components/video-message/video-message";

component-library/components/articles/articles.hugo.html

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -62,46 +62,53 @@
6262

6363
<!-- Main code -->
6464
{{ if not $error }}
65-
{{- partial "assets/section-title.html" (dict "heading" $args.heading "justify" $args.justify) -}}
65+
{{ if or (gt (len $pages) 0) (not $args.hideEmpty) }}
66+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "justify" $args.justify) -}}
6667

67-
{{ $partial := "assets/card-group.html" }}
68-
{{ $params := dict }}
69-
{{- $params = merge $params (dict
70-
"page" page
71-
"list" $pages
72-
"limit" $args.limit
73-
"cols" $args.cols
74-
"icon-rounded" $args.iconRounded
75-
"href" (cond $moreButton $moreLink "")
76-
"href-title" (cond $moreButton $moreTitle "")
77-
"href-force" (gt $result.total (len $result.pages))
78-
)}}
68+
{{ $partial := "assets/card-group.html" }}
69+
{{ $params := dict }}
70+
{{- $params = merge $params (dict
71+
"page" page
72+
"list" $pages
73+
"limit" $args.limit
74+
"cols" $args.cols
75+
"icon-rounded" $args.iconRounded
76+
"href" (cond $moreButton $moreLink "")
77+
"href-title" (cond $moreButton $moreTitle "")
78+
"href-force" (gt $result.total (len $result.pages))
79+
)}}
7980

80-
{{ if $args.scroll }}
81-
{{ $partial := "assets/stack.html" }}
82-
{{ $params = merge $params (dict
83-
"header-style" "none"
84-
"body-style" "title"
85-
"footer-style" "none"
86-
"gutter" 1
87-
"padding" 3
88-
"ratio" "1x1"
89-
"orientation" "horizontal-sm"
90-
"styles" (cond $args.bento $styles "")
91-
) -}}
92-
{{ else }}
93-
{{ $params = merge $params (dict
94-
"header-style" $args.headerStyle
95-
"footer-style" $args.footerStyle
96-
"padding" $args.padding
97-
"class" (or $args.class "border-0")
98-
"icon-style" "fa-2x"
99-
"align" "start"
100-
"orientation" $args.orientation
101-
"hook" "assets/live-card.html"
102-
"pagination" $args.pagination
103-
"paginate" $paginate
104-
) -}}
81+
{{ if $args.scroll }}
82+
{{ $partial := "assets/stack.html" }}
83+
{{ $params = merge $params (dict
84+
"header-style" "none"
85+
"body-style" "title"
86+
"footer-style" "none"
87+
"gutter" 1
88+
"padding" 3
89+
"ratio" "1x1"
90+
"orientation" "horizontal-sm"
91+
"styles" (cond $args.bento $styles "")
92+
) -}}
93+
{{ else }}
94+
{{ $params = merge $params (dict
95+
"header-style" $args.headerStyle
96+
"footer-style" $args.footerStyle
97+
"padding" $args.padding
98+
"class" (or $args.class "border-0")
99+
"icon-style" "fa-2x"
100+
"align" "start"
101+
"orientation" $args.orientation
102+
"hook" "assets/live-card.html"
103+
"pagination" $args.pagination
104+
"paginate" $paginate
105+
) -}}
106+
{{ end }}
107+
{{ if gt (len $pages) 0 }}
108+
{{ partial $partial $params }}
109+
{{ else }}
110+
{{- $padding := partial "utilities/GetPadding.html" -}}
111+
<p class="pt-{{ $padding.y }}">{{- T "emptyList" }}.</p>
112+
{{ end }}
105113
{{ end }}
106-
{{ partial $partial $params }}
107114
{{ end }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Metadata about this component, to be used in the CMS
2+
spec:
3+
structures:
4+
- content_blocks
5+
label: Panels
6+
description: Introduction section
7+
icon: check
8+
tags: []
9+
10+
# Defines the structure of this component, as well as the default values
11+
blueprint:
12+
heading:
13+
preheading:
14+
heading:
15+
content:
16+
align:
17+
width:
18+
cols:
19+
icon-rounded:
20+
padding:
21+
background:
22+
backdrop:
23+
color:
24+
subtle:
25+
elements:
26+
- title:
27+
icon:
28+
image:
29+
mode:
30+
content:
31+
tab-type:
32+
ratio:
33+
class:
34+
width:
35+
justify:
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{{/*
2+
Copyright © 2025 The Hinode Team / Mark Dumay. All rights reserved.
3+
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
4+
Visit gethinode.com/license for more details.
5+
*/}}
6+
7+
{{ $error := false }}
8+
9+
{{/* Initialize arguments */}}
10+
{{ $args := partial "utilities/InitArgs.html" (dict "bookshop" "panels" "args" .)}}
11+
{{ if or $args.err $args.warnmsg }}
12+
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
13+
"partial" "component-library/components/panels/panels.hugo.html"
14+
"warnid" "warn-invalid-arguments"
15+
"msg" "Invalid arguments"
16+
"details" ($args.errmsg | append $args.warnmsg)
17+
"file" page.File
18+
)}}
19+
{{ $error = $args.err }}
20+
{{ end }}
21+
22+
{{/* Initialize global arguments */}}
23+
{{- $breakpoint := partial "utilities/GetBreakpoint.html" -}}
24+
25+
{{/* Initialize local variables */}}
26+
{{ $list := slice }}
27+
{{ $titles := slice }}
28+
{{ $toc := slice }}
29+
{{ $parentID := printf "panel-%v" (cond (isset . "_ordinal") (index . "_ordinal") (md5 (delimit (slice . now) "-"))) }}
30+
{{ $inner := "" }}
31+
{{ range $i, $element := $args.elements }}
32+
{{ $toc = $toc | append (dict "href" "panel-0-1" "level" 2 "title" $element.title) }}
33+
34+
{{ $hero := partial "assets/hero.html" (dict
35+
"page" page
36+
"heading" (dict "title" $element.title "content" $element.content "width" 8 "size" 6)
37+
"background" $args.background
38+
"illustration" (dict "ratio" $args.ratio "icon" $element.icon "image" $element.image "mode" $element.mode)
39+
"order" $args.order
40+
"link-type" $args.linkType
41+
"links" $args.links
42+
"orientation" "horizontal"
43+
"align" "start"
44+
"width" 12
45+
)
46+
}}
47+
48+
{{- $output := partial "assets/nav-item.html" (dict
49+
"page" page
50+
"id" $i
51+
"parent-id" $parentID
52+
"fade" false
53+
"title" $element.title
54+
"show" (eq $i 0)
55+
"raw" $hero
56+
)
57+
-}}
58+
59+
{{ $inner = printf "%s\n%s" $inner $output }}
60+
{{ $titles = $titles | append $element.title }}
61+
{{ end}}
62+
63+
{{ if not $error }}
64+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "justify" $args.justify) -}}
65+
66+
{{- partial "assets/nav.html" (dict
67+
"id" (or $args.id $parentID)
68+
"page" page
69+
"nav-items" $inner
70+
"nav-titles" $titles
71+
"tab-type" $args.tabType
72+
"vertical" $args.vertical
73+
"word-wrap" $args.wordWrap
74+
"class" $args.class
75+
"pane" $args.pane
76+
"width" $args.width
77+
"responsive" $args.responsive
78+
)
79+
-}}
80+
{{ end }}
81+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.panels .dropdown-toggle {
2+
text-decoration: none !important;
3+
}

data/structures/nav-item.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ arguments:
1515
class:
1616
body:
1717
group: partial
18+
raw:
19+
group: partial
20+
release: v1.3.0
1821
navitem-type:
1922
release: v1.0.0
2023
illustration:

data/structures/nav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ arguments:
2222
release: v1.0.0
2323
class:
2424
pane:
25+
responsive:
26+
release: v1.4.0
2527
width:
2628
default: 12
2729
group: partial

exampleSite/config/_default/params.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
# themeFontPath = "https://fonts.googleapis.com/css2?family=Inter:wght@200;300;600&display=swap" # external path
130130
themeFontPath = "/fonts" # local path
131131
themeFontPreload = "/fonts/inter-v12-latin-regular.woff2"
132-
purge = true
132+
purge = false
133133
# toml-docs-end theme-colors
134134

135135
[schema]

0 commit comments

Comments
 (0)