Skip to content

Commit 900fce4

Browse files
authored
Merge pull request #1459 from gethinode/develop
Refine content blocks
2 parents 4e6aad3 + c82f9a4 commit 900fce4

File tree

14 files changed

+357
-13
lines changed

14 files changed

+357
-13
lines changed

component-library/bookshop.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import "modules/bookshop/shared/styles/global";
22
@import "modules/bookshop/components/about/about";
33
@import "modules/bookshop/components/articles/articles";
4+
@import "modules/bookshop/components/cards/cards";
45
@import "modules/bookshop/components/faq/faq";
56
@import "modules/bookshop/components/hero/hero";
67
@import "modules/bookshop/components/releases/releases";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ if or $args.err $args.warnmsg }}
1212
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
1313
"partial" "component-library/components/articles/articles.hugo.html"
14-
"warnid" "warn-invalid-arguments"
14+
"warnid" "warn-invalid-arguments"
1515
"msg" "Invalid arguments"
1616
"details" ($args.errmsg | append $args.warnmsg)
1717
"file" page.File
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Metadata about this component, to be used in the CMS
2+
spec:
3+
structures:
4+
- content_blocks
5+
label: Benefits
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+
orientation:
32+
class:
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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" "cards" "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/cards/cards.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 local variables */}}
23+
{{ $list := slice }}
24+
{{ range $args.elements }}
25+
<!-- TODO: check mode -->
26+
{{ $list = $list | append (dict
27+
"title" .title
28+
"description" (.content | page.RenderString)
29+
"icon" .icon
30+
"thumbnail" .image
31+
) }}
32+
{{ end}}
33+
34+
{{ if not $error }}
35+
<div class="container-xxl p-4 px-xxl-0">
36+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
37+
38+
{{- partial "assets/card-group.html" (dict
39+
"page" page
40+
"list" $list
41+
"class" (printf "border-0 card-icon-primary d-sm-none %s" $args.class)
42+
"cols" $args.cols
43+
"gutter" "4"
44+
"padding" $args.padding
45+
"header-style" "none"
46+
"footer-style" "none"
47+
"icon-rounded" $args.iconRounded
48+
"icon-style" "fa-2x"
49+
"align" "start"
50+
"orientation" ($args.orientation | default "horizontal-sm")
51+
"hook" "assets/live-card.html"
52+
) -}}
53+
54+
{{- partial "assets/card-group.html" (dict
55+
"page" page
56+
"list" $list
57+
"class" (printf "border-0 card-icon-primary d-none d-sm-block %s" $args.class)
58+
"cols" $args.cols
59+
"gutter" "4"
60+
"padding" $args.padding
61+
"header-style" "none"
62+
"footer-style" "none"
63+
"icon-rounded" $args.iconRounded
64+
"icon-style" "fa-2x"
65+
"align" "start"
66+
"orientation" ($args.orientation | default "stacked")
67+
"hook" "assets/live-card.html"
68+
) -}}
69+
</div>
70+
{{ end }}
71+

component-library/components/cards/cards.scss

Whitespace-only changes.

data/structures/_arguments.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ arguments:
430430
comment: Path to the download file, relative to the site's static folder.
431431

432432
# e
433+
elements:
434+
type: elements
435+
optional: false
436+
comment: >-
437+
Elements to include in the card group. Each element is rendered as a card.
433438
external:
434439
type: bool
435440
optional: true

data/structures/_types.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ types:
3232
items:
3333
- title:
3434
description:
35+
elements:
36+
- title:
37+
icon:
38+
image:
39+
mode:
40+
content:
3541
links:
3642
- title:
3743
url:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
_schema: default
3+
title: Articles
4+
description: Use the articles content block to show a group of article cards.
5+
icon: fas grip
6+
---
7+
8+
## Overview
9+
10+
The `articles` content block renders a group of article cards.
11+
12+
<!-- markdownlint-disable MD037 -->
13+
{{< example-bookshop lang="bookshop" >}}
14+
15+
```yml
16+
- _bookshop_name: articles
17+
heading:
18+
title: Blog
19+
align: start
20+
input:
21+
section: blog
22+
reverse: false
23+
sort: title
24+
hide-empty: false
25+
header-style: none
26+
more:
27+
title: More Blogs
28+
padding: 0
29+
max: 3
30+
class: border-0 card-zoom card-body-margin
31+
```
32+
33+
{{< /example-bookshop >}}
34+
<!-- markdownlint-enable MD037 -->
35+
36+
## Arguments
37+
38+
The content block supports the following arguments:
39+
40+
{{< args bookshop-articles >}}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
_schema: default
3+
title: Cards
4+
description: Use the cards content block to show a card group of messages.
5+
icon: fa address-card
6+
---
7+
8+
## Overview
9+
10+
The `cards` content block renders a group of content cards.
11+
12+
<!-- markdownlint-disable MD037 -->
13+
{{< example-bookshop lang="bookshop" >}}
14+
15+
```yml
16+
- _bookshop_name: cards
17+
heading:
18+
preheading: Preheading
19+
title: Heading
20+
content: Cards content. It supports multiple lines.
21+
align: start
22+
background:
23+
color: primary
24+
subtle: true
25+
orientation: stacked
26+
icon-rounded: true
27+
class: text-center
28+
elements:
29+
- title: First Card
30+
icon: fas 1
31+
- title: Second Card
32+
icon: fas 2
33+
- title: Third Card
34+
icon: fas 3
35+
```
36+
37+
{{< /example-bookshop >}}
38+
<!-- markdownlint-enable MD037 -->
39+
40+
## Arguments
41+
42+
The content block supports the following arguments:
43+
44+
{{< args bookshop-cards >}}

0 commit comments

Comments
 (0)