Skip to content

Commit 8c5e032

Browse files
authored
Merge pull request #1462 from gethinode/develop
Make padding globally configurable
2 parents 05af8f7 + 47a410f commit 8c5e032

File tree

19 files changed

+110
-66
lines changed

19 files changed

+110
-66
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
<!-- Main code -->
6464
{{ if not $error }}
65-
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
65+
{{- partial "assets/section-title.html" (dict "heading" $args.heading) -}}
6666

6767
{{ $partial := "assets/card-group.html" }}
6868
{{ $params := dict }}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
{{ $error = $args.err }}
2020
{{ end }}
2121

22+
{{/* Initialize global arguments */}}
23+
{{- $breakpoint := partial "utilities/GetBreakpoint.html" -}}
24+
2225
{{/* Initialize local variables */}}
2326
{{ $list := slice }}
2427
{{ range $args.elements }}
@@ -32,12 +35,12 @@
3235
{{ end}}
3336

3437
{{ if not $error }}
35-
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
38+
{{- partial "assets/section-title.html" (dict "heading" $args.heading) -}}
3639

3740
{{- partial "assets/card-group.html" (dict
3841
"page" page
3942
"list" $list
40-
"class" (printf "border-0 card-icon-primary d-sm-none %s" $args.class)
43+
"class" (printf "border-0 card-icon-primary d-%s-none %s" $breakpoint.prev $args.class)
4144
"cols" $args.cols
4245
"gutter" "4"
4346
"padding" $args.padding
@@ -53,7 +56,7 @@
5356
{{- partial "assets/card-group.html" (dict
5457
"page" page
5558
"list" $list
56-
"class" (printf "border-0 card-icon-primary d-none d-sm-block %s" $args.class)
59+
"class" (printf "border-0 card-icon-primary d-none d-%s-block %s" $breakpoint.prev $args.class)
5760
"cols" $args.cols
5861
"gutter" "4"
5962
"padding" $args.padding

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
{{ if not $args.err }}
2020
{{ $color := "" }}
2121
{{ 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-
) -}}
22+
{{- partial "assets/section-title.html" (dict "heading" $args.heading "color" $color) -}}
2723

2824
{{ $class := "" }}
2925
{{ $id := printf "faq-%s" (md5 (delimit (slice . now) "-")) }}

component-library/components/video-message/video-message.hugo.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
{{ end }}
1818

1919
{{- $breakpoint := partial "utilities/GetBreakpoint.html" -}}
20+
{{- $padding := partial "utilities/GetPadding.html" -}}
2021

2122
{{- define "_partials/inline/video.html" -}}
2223
{{ $provider := .provider }}
@@ -25,10 +26,14 @@
2526
{{ $autoplay := .autoplay }}
2627
{{ $queryArgs := .queryArgs }}
2728
{{ $border := .border }}
29+
{{ $padding := .padding }}
2830

2931
{{ if site.Params.env_bookshop_live }}
3032
{{/* Define dummy content as we cannot retrieve video data in live mode */}}
31-
{{- partial "assets/live-image.html" (dict "src" "/img/placeholder-video.svg" "ratio" "21x9" "wrapper" "text-center mb-4") -}}
33+
{{- partial "assets/live-image.html" (dict
34+
"src" "/img/placeholder-video.svg"
35+
"ratio" "21x9"
36+
"wrapper" (printf "text-center mb-%d" $padding.y)) -}}
3237
{{ else }}
3338
<div class="video-container{{ if $border }} video-container-border{{ end}}">
3439
{{ partial "assets/video.html" (dict
@@ -91,13 +96,10 @@
9196
) }}
9297
{{ end}}
9398

94-
{{- partial "assets/section-title.html" (dict
95-
"heading" $args.heading
96-
"class" "py-5"
97-
) -}}
99+
{{- partial "assets/section-title.html" (dict "heading" $args.heading) -}}
98100

99101
{{ if eq $args.orientation "stacked" }}
100-
<div class="col-{{ $breakpoint.current }}-{{ $args.width }} mx-auto">
102+
<div class="col-{{ $breakpoint.current }}-{{ $args.width }} mx-auto pb-{{ $padding.y }}">
101103
{{ with $args.video }}
102104
{{- partial "inline/video.html" (dict
103105
"provider" .provider
@@ -106,14 +108,15 @@
106108
"autoplay" .autoplay
107109
"query-args" .queryArgs
108110
"border" $.border
111+
"padding" $padding
109112
) -}}
110113
{{ end }}
111114
</div>
112-
<div class="mt-4">
115+
<div class="mt-{{ $padding.y }} pb-{{ $padding.y }}">
113116
{{- partial "inline/messages.html" (dict "list" $list "cols" $args.cols "type" $args.type "iconRounded" $args.iconRounded) -}}
114117
</div>
115118
{{ else }}
116-
<div class="container grid gap-4">
119+
<div class="container grid gap-4 pb-{{ $padding.y }}">
117120
<div class="row row-cols-1 row-cols-{{ $breakpoint.current }}-2">
118121
<div class="col col-{{ $breakpoint.current }}-{{ $args.width }} p-0">
119122
{{ with $args.video }}
@@ -124,10 +127,11 @@
124127
"autoplay" .autoplay
125128
"query-args" .queryArgs
126129
"border" $.border
130+
"padding" $padding
127131
) -}}
128132
{{ end }}
129133
</div>
130-
<div class="col col-{{ $breakpoint.current }}-{{ sub 12 $args.width }} mt-4 mt-{{ $breakpoint.current }}-0">
134+
<div class="col col-{{ $breakpoint.current }}-{{ sub 12 $args.width }} mt-{{ $padding.y }} mt-{{ $breakpoint.current }}-0">
131135
{{- partial "inline/messages.html" (dict "list" $list "cols" 1 "type" $args.type "iconRounded" $args.iconRounded) -}}
132136
</div>
133137
</div>

component-library/helpers/component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{- $component_props := index . 1 -}}
1616
{{- $class := index . 2 | default "p-0" -}}
1717
{{- $bgclass := index . 3 | default "" -}}
18-
18+
{{- $padding := partial "utilities/GetPadding.html" -}}
1919
{{- $component_path := partial "_bookshop/helpers/component_key" $component_name -}}
2020
{{- $flat_component_path := partial "_bookshop/helpers/flat_component_key" $component_name -}}
2121

@@ -34,7 +34,7 @@
3434
{{- $style := index $component_props "wrapper" -}}
3535
{{- $width := index $component_props "width" -}}
3636
{{- $justify := index $component_props "justify" | default "start" -}}
37-
{{- $padding := cond (ne $component_name "separator") "px-4 px-xxl-0 py-4" "" -}}
37+
{{- $padding := cond (ne $component_name "separator") (printf "px-%d px-xxl-0 py-%d" $padding.x $padding.y) "" -}}
3838
{{- $wrapper := $style }}
3939
{{ with $background }}
4040
{{ $wrapper = partial "utilities/GetBackgroundStyle.html" (dict "background" . "class" $style) }}

config/_default/params.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
footerBelowFold = false
1111
loading = "lazy"
1212
breakpoint = "md"
13+
[main.padding]
14+
x = 4
15+
y = 4
1316
titleCase = false
1417
[main.internalLinks]
1518
validate = true

exampleSite/config/_default/params.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
footerBelowFold = false
99
loading = "lazy"
1010
breakpoint = "md"
11+
[main.padding]
12+
x = 4
13+
y = 4
1114
titleCase = true
1215
[main.internalLinks]
1316
validate = true

exampleSite/content/en/blocks/articles.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ The `articles` content block renders a group of article cards.
2727
title: More Blogs
2828
padding: 0
2929
max: 3
30+
background:
31+
color: primary
32+
subtle: true
3033
class: border-0 card-zoom card-body-margin
34+
justify: center
3135
```
3236
3337
{{< /example-bookshop >}}

exampleSite/hugo_stats.json

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
"bg-body",
101101
"bg-body-tertiary",
102102
"bg-danger",
103-
"bg-info-subtle",
104103
"bg-opacity-10",
105104
"bg-primary",
106105
"bg-primary-subtle",
@@ -231,6 +230,7 @@
231230
"fa-arrow-right",
232231
"fa-book-open",
233232
"fa-bootstrap",
233+
"fa-check",
234234
"fa-chevron-right",
235235
"fa-circle",
236236
"fa-circle-check",
@@ -260,9 +260,11 @@
260260
"fa-markdown",
261261
"fa-medium",
262262
"fa-moon",
263+
"fa-robot",
263264
"fa-rocket",
264265
"fa-rotate-90",
265266
"fa-share-nodes",
267+
"fa-sitemap",
266268
"fa-sort",
267269
"fa-square-check",
268270
"fa-stack",
@@ -430,7 +432,6 @@
430432
"pt-4",
431433
"pt-5",
432434
"pt-md-0",
433-
"pt-md-3",
434435
"ptw-3",
435436
"ptw-5",
436437
"ptw-lg-5",
@@ -442,9 +443,7 @@
442443
"py-2",
443444
"py-3",
444445
"py-4",
445-
"py-5",
446446
"py-md-1",
447-
"py-md-5",
448447
"ratio",
449448
"ratio-16x9",
450449
"releases",
@@ -572,7 +571,6 @@
572571
"animatie",
573572
"animation",
574573
"arguments",
575-
"automated",
576574
"background-type",
577575
"badge",
578576
"barre-de-navigation",
@@ -582,6 +580,7 @@
582580
"body-file-collapse-1",
583581
"bouton",
584582
"breadcrumb",
583+
"build-a-static-website-fast-and-flexible",
585584
"button",
586585
"button-group",
587586
"c4-diagram",
@@ -591,7 +590,6 @@
591590
"carousel-0",
592591
"carrousel",
593592
"carte",
594-
"check-our-guides-to-get-you-started",
595593
"chronologie",
596594
"class-diagram",
597595
"cloudinary",
@@ -603,13 +601,12 @@
603601
"container",
604602
"content-blocks",
605603
"cookies-etc",
606-
"creating-your-website-has-never-been-easier",
607604
"custom-activity",
608605
"data-tables",
606+
"developer-friendly-and-secure",
609607
"docs",
610608
"documentation",
611609
"elements-type",
612-
"embrace-the-power-of-open-source",
613610
"entity-relationship-diagram",
614611
"example",
615612
"exemple",
@@ -626,23 +623,24 @@
626623
"fab-medium",
627624
"fab-whatsapp",
628625
"fab-x-twitter",
629-
"faq-0531e8f162271c7364df25bde932ba4a",
630-
"faq-0531e8f162271c7364df25bde932ba4a-heading-faq-0531e8f162271c7364df25bde932ba4a",
631-
"faq-0531e8f162271c7364df25bde932ba4a-item-0",
632-
"faq-0531e8f162271c7364df25bde932ba4a-item-1",
633-
"faq-0531e8f162271c7364df25bde932ba4a-item-2",
634-
"faq-25686b4e63cfe7fc2ad1ede047ee330d",
635-
"faq-25686b4e63cfe7fc2ad1ede047ee330d-heading-faq-25686b4e63cfe7fc2ad1ede047ee330d",
636-
"faq-25686b4e63cfe7fc2ad1ede047ee330d-item-0",
637-
"faq-25686b4e63cfe7fc2ad1ede047ee330d-item-1",
638-
"faq-25686b4e63cfe7fc2ad1ede047ee330d-item-2",
626+
"faq-67ad4c758cb8e680d2d48fb01d29afc5",
627+
"faq-67ad4c758cb8e680d2d48fb01d29afc5-heading-faq-67ad4c758cb8e680d2d48fb01d29afc5",
628+
"faq-67ad4c758cb8e680d2d48fb01d29afc5-item-0",
629+
"faq-67ad4c758cb8e680d2d48fb01d29afc5-item-1",
630+
"faq-67ad4c758cb8e680d2d48fb01d29afc5-item-2",
631+
"faq-df128f2a590f4e2e67764b3978283baa",
632+
"faq-df128f2a590f4e2e67764b3978283baa-heading-faq-df128f2a590f4e2e67764b3978283baa",
633+
"faq-df128f2a590f4e2e67764b3978283baa-item-0",
634+
"faq-df128f2a590f4e2e67764b3978283baa-item-1",
635+
"faq-df128f2a590f4e2e67764b3978283baa-item-2",
639636
"fas-1",
640637
"fas-2",
641638
"fas-3",
642639
"fas-angle-left",
643640
"fas-arrow-left",
644641
"fas-arrow-right",
645642
"fas-book-open",
643+
"fas-check",
646644
"fas-chevron-right",
647645
"fas-circle",
648646
"fas-circle-check",
@@ -661,16 +659,18 @@
661659
"fas-link",
662660
"fas-magnifying-glass",
663661
"fas-moon",
662+
"fas-robot",
664663
"fas-rocket",
665664
"fas-share-nodes",
665+
"fas-sitemap",
666666
"fas-sort",
667667
"fas-sun",
668668
"fas-timeline",
669669
"fas-up-right-from-square",
670-
"fast",
671670
"fichier",
672671
"fil-dariane",
673672
"file",
673+
"flexible--ready-to-use",
674674
"flowchart",
675675
"footer-docs-collapse-15",
676676
"footer-file-collapse-1",
@@ -713,7 +713,6 @@
713713
"messages-type",
714714
"mindmap",
715715
"more-type",
716-
"multilingual",
717716
"nav",
718717
"nav-0-0",
719718
"nav-0-1",
@@ -731,10 +730,10 @@
731730
"navbar-sample-collapse",
732731
"navigation",
733732
"notification",
734-
"optimized",
735733
"overview",
736734
"persona",
737735
"pie-chart",
736+
"powered-by-open-source",
738737
"projecten",
739738
"projects",
740739
"projets",
@@ -743,9 +742,7 @@
743742
"que-sont-les-cookies-",
744743
"release",
745744
"requirement-chart",
746-
"responsive",
747745
"réduire",
748-
"secure",
749746
"security",
750747
"sequence-diagram",
751748
"spinner",

layouts/_partials/assets/card-group.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
{{- end -}}
3131

3232
{{/* Initialize global variables */}}
33+
{{- $breakpoint := partial "utilities/GetBreakpoint.html" -}}
34+
{{- $padding := partial "utilities/GetPadding.html" -}}
3335
{{- $pretty := site.Params.main.internalLinks.pretty | default false -}}
3436

3537
{{/* Initialize local variables */}}
@@ -186,15 +188,19 @@
186188

187189
{{- if $paginator -}}
188190
{{- if gt $paginator.TotalPages 1 -}}
189-
<div class="pt-3">{{- partial "assets/pagination.html" (dict "page" $args.page "format" "terse") -}}</div>
191+
<div class="pt-{{ $padding.y }}">{{- partial "assets/pagination.html" (dict "page" $args.page "format" "terse") -}}</div>
190192
{{- end -}}
191193
{{- else -}}
192194
{{- if or (and (gt $count $max) $args.hrefTitle) (and $args.hrefForce $args.hrefTitle) -}}
193195
{{- $href := $args.href -}}
194196
{{- if and $pretty (not (hasSuffix $href "/" )) (not (strings.Contains $href "#")) -}}
195197
{{- $href = printf "%s/" $href -}}
196198
{{- end -}}
197-
<a class="btn btn-outline-primary mt-4" href="{{ $href | safeURL }}" role="button">{{ $args.hrefTitle }}</a>
199+
<div class="mt-{{ $padding.y }} w-100">
200+
<a class="btn btn-outline-primary" href="{{ $href | safeURL }}" role="button">
201+
{{ $args.hrefTitle }}
202+
</a>
203+
</div>
198204
{{- end -}}
199205
{{- end -}}
200206
{{- end -}}

0 commit comments

Comments
 (0)