Skip to content

Commit 05af8f7

Browse files
authored
Merge pull request #1461 from gethinode/develop
Refactor bookshop components
2 parents d3fe893 + 977c82b commit 05af8f7

29 files changed

+352
-515
lines changed

component-library/components/about/about.bookshop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ blueprint:
3030
mode:
3131
order:
3232
width:
33+
justify:
3334
link-type:
3435
links:
3536
-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"link-type" $args.linkType
2727
"links" $args.links
2828
"orientation" "horizontal"
29-
"width" (or .width 8)
29+
"width" (or $args.width 8)
3030
)
3131
}}
3232
{{- end -}}

component-library/components/articles/articles.bookshop.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ blueprint:
4242
header-style:
4343
footer-style:
4444
orientation:
45-
class:
45+
class:
46+
width:
47+
justify:

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

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -62,48 +62,46 @@
6262

6363
<!-- Main code -->
6464
{{ if not $error }}
65-
<div class="container-xxl p-4 px-xxl-0">
66-
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
65+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
6766

68-
{{ $partial := "assets/card-group.html" }}
69-
{{ $params := dict }}
70-
{{- $params = merge $params (dict
71-
"page" page
72-
"list" $pages
73-
"max" $args.max
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-
)}}
67+
{{ $partial := "assets/card-group.html" }}
68+
{{ $params := dict }}
69+
{{- $params = merge $params (dict
70+
"page" page
71+
"list" $pages
72+
"max" $args.max
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+
)}}
8079

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-
{{ partial $partial $params }}
108-
</div>
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+
) -}}
105+
{{ end }}
106+
{{ partial $partial $params }}
109107
{{ end }}

component-library/components/cards/cards.bookshop.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ blueprint:
2929
mode:
3030
content:
3131
orientation:
32-
class:
32+
class:
33+
width:
34+
justify:

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

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,38 @@
3232
{{ end}}
3333

3434
{{ 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") -}}
35+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
3736

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-
) -}}
37+
{{- partial "assets/card-group.html" (dict
38+
"page" page
39+
"list" $list
40+
"class" (printf "border-0 card-icon-primary d-sm-none %s" $args.class)
41+
"cols" $args.cols
42+
"gutter" "4"
43+
"padding" $args.padding
44+
"header-style" "none"
45+
"footer-style" "none"
46+
"icon-rounded" $args.iconRounded
47+
"icon-style" "fa-2x"
48+
"align" "start"
49+
"orientation" ($args.orientation | default "horizontal-sm")
50+
"hook" "assets/live-card.html"
51+
) -}}
5352

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>
53+
{{- partial "assets/card-group.html" (dict
54+
"page" page
55+
"list" $list
56+
"class" (printf "border-0 card-icon-primary d-none d-sm-block %s" $args.class)
57+
"cols" $args.cols
58+
"gutter" "4"
59+
"padding" $args.padding
60+
"header-style" "none"
61+
"footer-style" "none"
62+
"icon-rounded" $args.iconRounded
63+
"icon-style" "fa-2x"
64+
"align" "start"
65+
"orientation" ($args.orientation | default "stacked")
66+
"hook" "assets/live-card.html"
67+
) -}}
7068
{{ end }}
7169

component-library/components/faq/faq.bookshop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ blueprint:
1717
width:
1818
size:
1919
contrast:
20+
width:
21+
justify:
2022
background:
2123
backdrop:
2224
color:

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

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,41 @@
1717
{{ end }}
1818

1919
{{ if not $args.err }}
20-
<div class="container-xxl p-4 px-xxl-0">
21-
{{ $color := "" }}
22-
{{ if $args.contrast }}{{ $color = "white" }}{{ end }}
23-
{{- partial "assets/section-title.html" (dict
24-
"heading" $args.heading
25-
"color" $color
26-
"class" "py-5"
27-
) -}}
20+
{{ $color := "" }}
21+
{{ if $args.contrast }}{{ $color = "white" }}{{ end }}
22+
{{- partial "assets/section-title.html" (dict
23+
"heading" $args.heading
24+
"color" $color
25+
"class" "py-5"
26+
) -}}
2827

29-
{{ $class := "" }}
30-
{{ $id := printf "faq-%s" (md5 (delimit (slice . now) "-")) }}
28+
{{ $class := "" }}
29+
{{ $id := printf "faq-%s" (md5 (delimit (slice . now) "-")) }}
3130

32-
<div id="{{ $id }}" class="accordion accordion-faq {{ if $args.contrast }}accordion-faq-contrast text-white {{ end }}accordion-flush mb-3{{ with $class }} {{ . }}{{ end }} col-12 col-md-6 mx-auto">
33-
{{ range $index, $item := $args.items }}
34-
<div class="accordion-item">
35-
{{- with $item.title -}}
36-
<div class="accordion-header m-0" id="{{ $id }}-heading-{{ $id }}">
37-
<button class="accordion-button collapsed"
38-
type="button"
39-
data-bs-toggle="collapse"
40-
data-bs-target="#{{ $id }}-item-{{ $index }}"
41-
aria-expanded="false"
42-
aria-controls="{{ $id }}-item-{{ $index }}"
43-
>
44-
{{ if $args.color }}<div class="text-{{ $args.color }}">{{ . }}</div>{{ else }}{{ . }}{{ end }}
45-
</button>
46-
</div>
47-
{{- end -}}
48-
<div id="{{ $id }}-item-{{ $index }}"
49-
class="accordion-collapse collapse"
50-
aria-labelledby="{{ $id }}-heading-{{ $index }}"
51-
data-bs-parent="#{{ $id }}"
52-
>
53-
<div class="accordion-body">{{ $item.description | page.RenderString | safeHTML }}</div>
31+
<div id="{{ $id }}" class="accordion accordion-faq {{ if $args.contrast }}accordion-faq-contrast text-white {{ end }}accordion-flush mb-3{{ with $class }} {{ . }}{{ end }} col-12 col-md-6 mx-auto">
32+
{{ range $index, $item := $args.items }}
33+
<div class="accordion-item">
34+
{{- with $item.title -}}
35+
<div class="accordion-header m-0" id="{{ $id }}-heading-{{ $id }}">
36+
<button class="accordion-button collapsed"
37+
type="button"
38+
data-bs-toggle="collapse"
39+
data-bs-target="#{{ $id }}-item-{{ $index }}"
40+
aria-expanded="false"
41+
aria-controls="{{ $id }}-item-{{ $index }}"
42+
>
43+
{{ if $args.color }}<div class="text-{{ $args.color }}">{{ . }}</div>{{ else }}{{ . }}{{ end }}
44+
</button>
5445
</div>
46+
{{- end -}}
47+
<div id="{{ $id }}-item-{{ $index }}"
48+
class="accordion-collapse collapse"
49+
aria-labelledby="{{ $id }}-heading-{{ $index }}"
50+
data-bs-parent="#{{ $id }}"
51+
>
52+
<div class="accordion-body">{{ $item.description | page.RenderString | safeHTML }}</div>
5553
</div>
56-
{{ end }}
57-
</div>
54+
</div>
55+
{{ end }}
5856
</div>
5957
{{ end }}

component-library/components/hero/hero.bookshop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ blueprint:
3838
cover:
3939
orientation:
4040
width:
41+
justify:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"links" $args.links
3131
"orientation" $args.orientation
3232
"width" $args.width
33+
"justify" $args.justify
3334
)
3435
}}
3536
{{ end }}

0 commit comments

Comments
 (0)