Skip to content

Commit 7222195

Browse files
authored
Merge pull request #1675 from gethinode/templatev2
Templatev2
2 parents 5a8c810 + 18ed41c commit 7222195

File tree

9 files changed

+377
-46
lines changed

9 files changed

+377
-46
lines changed

component-library/bookshop.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
@import "modules/bookshop/components/panels/panels";
1313
@import "modules/bookshop/components/releases/releases";
1414
@import "modules/bookshop/components/separator/separator";
15+
@import "modules/bookshop/components/team/team";
1516
@import "modules/bookshop/components/video-message/video-message";
1617
@import "modules/bookshop/theme";
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Metadata about this component, to be used in the CMS
2+
spec:
3+
structures:
4+
- content_blocks
5+
label: Teams
6+
description: Teams section
7+
icon: groups
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+
hide-empty:
19+
input:
20+
section:
21+
nested:
22+
keywords:
23+
categories:
24+
tags:
25+
reverse:
26+
sort:
27+
more:
28+
title:
29+
link:
30+
link-type:
31+
icon:
32+
cols:
33+
padding:
34+
limit:
35+
pagination:
36+
paginate:
37+
background:
38+
backdrop:
39+
color:
40+
subtle:
41+
cover:
42+
header-style:
43+
body-style:
44+
footer-style:
45+
orientation:
46+
class:
47+
width:
48+
justify:
49+
fluid:
50+
theme:
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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" "team" "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/team/team.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+
{{- $padding := partial "utilities/GetPadding.html" -}}
24+
25+
{{/* Initialize local variables */}}
26+
{{ $pages := slice }}
27+
{{ $result := partial "assets/live-pages.html" (dict
28+
"page" $args.page
29+
"section" $args.input.section
30+
"nested" $args.input.nested
31+
"keywords" $args.input.keywords
32+
"categories" $args.input.categories
33+
"tags" $args.input.tags
34+
"sort" $args.input.sort
35+
"reverse" $args.input.reverse
36+
)}}
37+
{{ $pages = $result.pages }}
38+
39+
<!-- Define more button -->
40+
{{ $moreButton := site.Params.modules.bookshop.team.moreButton | default false }}
41+
{{ $moreTitle := T "more" (pluralize $args.input.section) }}
42+
{{ $moreLink := $args.input.section }}
43+
{{ $moreType := "button" }}
44+
{{ $moreIcon := "" }}
45+
{{ with $args.more }}
46+
{{ if .title }}{{ $moreTitle = .title }}{{ end }}
47+
{{ if .link }}{{ $moreLink = .link }}{{ end }}
48+
{{ if index . "link-type" }}{{ $moreType = index . "link-type" }}{{ end }}
49+
{{ if .icon }}{{ $moreIcon = .icon }}{{ end }}
50+
{{ end }}
51+
52+
{{ $paginate := $args.paginate }}
53+
{{ if and $paginate page.IsPage }}
54+
{{ partial "utilities/LogWarn.html" (dict
55+
"partial" "component-library/components/team/team.hugo.html"
56+
"msg" "Pagination not supported"
57+
"file" page.File
58+
)}}
59+
{{ $paginate = false }}
60+
{{ end }}
61+
62+
{{/* Main code */}}
63+
{{ if not $error }}
64+
{{ if or (gt (len $pages) 0) (not $args.hideEmpty) }}
65+
{{- partial "assets/section-title.html" (dict
66+
"heading" $args.heading
67+
"justify" $args.justify
68+
"class" (printf "pb-%d" $padding.y))
69+
-}}
70+
71+
{{ $partial := "assets/card-group.html" }}
72+
{{ $params := dict }}
73+
{{- $params = merge $params (dict
74+
"page" page
75+
"list" $pages
76+
"cols" $args.cols
77+
"limit" $args.limit
78+
"padding" $args.padding
79+
"href" (cond $moreButton $moreLink "")
80+
"href-force" (gt $result.total (len $result.pages))
81+
)}}
82+
83+
{{ $params = merge $params (dict
84+
"ratio" "1x1"
85+
"header-style" $args.headerStyle
86+
"body-style" $args.bodyStyle
87+
"footer-style" $args.footerStyle
88+
"class" (or $args.class "border-0")
89+
"align" "center"
90+
"orientation" $args.orientation
91+
"href-title" (cond $moreButton $moreTitle "")
92+
"icon-rounded" $args.iconRounded
93+
"icon-style" $args.iconStyle
94+
"hook" "assets/live-card.html"
95+
"more-link-type" $moreType
96+
"more-link-icon" $moreIcon
97+
"pagination" $args.pagination
98+
"paginate" $paginate
99+
) -}}
100+
{{ if gt (len $pages) 0 }}
101+
{{ partial $partial $params }}
102+
{{ else }}
103+
<p class="pt-{{ $padding.y }}">{{- T "emptyList" }}.</p>
104+
{{ end }}
105+
{{ end }}
106+
{{ end }}

component-library/components/team/team.scss

Whitespace-only changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
_schema: default
3+
title: Team
4+
description: Use the team content block to show a group of team members.
5+
icon: fas grip
6+
---
7+
8+
## Overview
9+
10+
The `team` content block renders a group of team members.
11+
12+
<!-- markdownlint-disable MD037 -->
13+
{{< example-bookshop lang="bookshop" >}}
14+
15+
```yml
16+
- _bookshop_name: team
17+
heading:
18+
title: Team
19+
align: start
20+
input:
21+
section: team
22+
reverse: false
23+
sort: title
24+
cols: 3
25+
hide-empty: false
26+
header-style: none
27+
padding: 0
28+
background:
29+
color: primary
30+
subtle: true
31+
class: border-0 card-zoom card-body-margin
32+
justify: start
33+
```
34+
35+
{{< /example-bookshop >}}
36+
<!-- markdownlint-enable MD037 -->
37+
38+
## Arguments
39+
40+
The content block supports the following arguments:
41+
42+
{{< args bookshop-team >}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- $contacts := partial "utilities/GetI18nData.html" (dict "page" site "data" "contacts") }}
2+
3+
{{ range $contacts }}
4+
{{ $content := dict "mediaType" "text/markdown" "value" .biography }}
5+
{{ $page := dict
6+
"content" $content
7+
"description" .function
8+
"kind" "page"
9+
"type" "contact"
10+
"path" (.name | anchorize)
11+
"slug" (.name | anchorize)
12+
"title" .name
13+
"params" (merge . (dict "thumbnail" .image))
14+
}}
15+
{{ $.AddPage $page }}
16+
{{ end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
_schema: default
3+
title: Team
4+
date:
5+
description: Meet our team of experts.
6+
content_blocks:
7+
- _bookshop_name: team
8+
heading:
9+
title: Meet our team
10+
content: >-
11+
Our team consists of seasoned experts in their field.
12+
input:
13+
section: team
14+
cols: 5
15+
header-style: none
16+
padding: 0
17+
class: card-zoom border-0
18+
---

0 commit comments

Comments
 (0)