Skip to content

Commit 9c746ec

Browse files
authored
Merge pull request #1572 from gethinode/develop
fix: enable passthrough argument for building blocks
2 parents 593ab2c + c161063 commit 9c746ec

File tree

4 files changed

+78
-64
lines changed

4 files changed

+78
-64
lines changed

component-library/helpers/component.html

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,35 @@
2727
{{- $resolved_component = $flat_component_path -}}
2828
{{- end -}}
2929

30+
<!-- TODO: use initialized component args instead of component_props -->
31+
{{ $error := false }}
32+
{{ $args := dict }}
3033
{{- if $resolved_component -}}
34+
{{ $args = partial "utilities/InitArgs.html" (dict "bookshop" $component_name "args" $component_props) }}
35+
{{ if or $args.err $args.warnmsg }}
36+
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
37+
"partial" $resolved_component
38+
"warnid" "warn-invalid-arguments"
39+
"msg" "Invalid arguments"
40+
"details" ($args.errmsg | append $args.warnmsg)
41+
"file" page.File
42+
)}}
43+
{{ end }}
44+
{{ end }}
45+
46+
{{ if and $resolved_component (not $args.err) }}
3147
{{- $id := index $component_props "id" -}}
3248
{{- $cover := index $component_props "cover" -}}
3349
{{- $background := index $component_props "background" -}}
3450
{{- $backdrop := "" -}}
3551
{{- $fluid := index $component_props "fluid" | default true -}}
36-
{{- $style := index $component_props "wrapper" -}}
52+
{{- $wrapper := index $component_props "wrapper" -}}
3753
{{- $width := index $component_props "width" -}}
3854
{{- $justify := index $component_props "justify" | default "start" -}}
3955
{{- $paddingOuter := cond (ne $component_name "separator") (printf "px-xxl-0 px-%d py-0" $padding.x) "" -}}
4056
{{- $padding := cond (ne $component_name "separator") (printf "px-%d %spy-%d" $padding.x (cond $fluid "px-xxl-0 " "") $padding.y) "" -}}
41-
{{- $wrapper := $style }}
4257
{{ with $background }}
43-
{{ $wrapper = partial "utilities/GetBackgroundStyle.html" (dict "background" . "class" $style) }}
58+
{{ $wrapper = partial "utilities/GetBackgroundStyle.html" (dict "background" . "class" $wrapper) }}
4459
{{ if reflect.IsMap $background }}
4560
{{ with $background.backdrop }}{{ $wrapper = "" }}{{ $backdrop = . }}{{ end }}
4661
{{ end }}
@@ -73,18 +88,21 @@
7388
{{- end -}}
7489

7590
{{ $col := cond (and $width (lt $width 12)) (printf "col-12 col-md-%d" $width) "" }}
76-
77-
<div class="container-{{ cond $fluid "xxl" "fluid" }} {{ $padding }} d-flex flex-column align-items-{{ $justify }}">
78-
{{ with $col }}
79-
<div class="{{ . }}">{{ partial $resolved_component $component_props }}</div>
80-
{{ else }}
81-
{{ partial $resolved_component $component_props }}
82-
{{ end}}
83-
</div>
91+
{{ if $args.passthrough }}
92+
{{ partial $resolved_component $component_props }}
93+
{{ else }}
94+
<div class="container-{{ cond $fluid "xxl" "fluid" }} {{ $padding }} d-flex flex-column align-items-{{ $justify }}">
95+
{{ with $col }}
96+
<div class="{{ . }}">{{ partial $resolved_component $component_props }}</div>
97+
{{ else }}
98+
{{ partial $resolved_component $component_props }}
99+
{{ end}}
100+
</div>
101+
{{ end }}
84102
</section>
85103
{{ if not $fluid }}</div>{{ end }}
86104
{{ "<!--bookshop-live end-->" | safeHTML }}
87-
{{- else -}}
105+
{{- else if (not $args.err) -}}
88106
{{- $file_loc := slicestr $component_path 9 -}}
89107
{{- $flat_file_loc := slicestr $flat_component_path 9 -}}
90108
{{- partial "_bookshop/errors/err" (printf "Component \"%s\" does not exist.\n Create this component by placing a file in your bookshop at %s or %s" $component_name $file_loc $flat_file_loc) -}}

exampleSite/hugo_stats.json

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@
245245
"fa-activity",
246246
"fa-address-card",
247247
"fa-angle-left",
248-
"fa-angle-right",
249-
"fa-angles-left",
250-
"fa-angles-right",
251248
"fa-arrow-left",
252249
"fa-arrow-right",
253250
"fa-bootstrap",
@@ -659,11 +656,11 @@
659656
"docs",
660657
"documentation",
661658
"dropdown-nav-0",
662-
"dropdown-panel-0e0d7c1fd6d33e3180b75a3f126f5fea",
663-
"dropdown-panel-3afb6d66b09dfeb4621548fc9812ce10",
664-
"dropdown-panel-46f581d5bacea14d68114161d503d5c1",
665-
"dropdown-panel-e37d2a3ed3fbb2ae9956fe2816627070",
666-
"dropdown-panel-effd2deef2e0cded9c2d41c8aaec9646",
659+
"dropdown-panel-4bb40e55576372d7d5033b3cb5988c2c",
660+
"dropdown-panel-6dfba858bf9eaea88ebc32de712ebf3f",
661+
"dropdown-panel-6fe204644b3fccca0d62ab3b712bf1cd",
662+
"dropdown-panel-b8350cafdd51c4d33847172721da9800",
663+
"dropdown-panel-e25d76a286385f8669a497412d250185",
667664
"elements-type",
668665
"entity-relationship-diagram",
669666
"example",
@@ -681,19 +678,16 @@
681678
"fab-medium",
682679
"fab-whatsapp",
683680
"fab-x-twitter",
684-
"faq-963137b2b2e4941741e0ab33cf4fd1fe",
685-
"faq-963137b2b2e4941741e0ab33cf4fd1fe-heading-faq-963137b2b2e4941741e0ab33cf4fd1fe",
686-
"faq-963137b2b2e4941741e0ab33cf4fd1fe-item-0",
687-
"faq-963137b2b2e4941741e0ab33cf4fd1fe-item-1",
688-
"faq-963137b2b2e4941741e0ab33cf4fd1fe-item-2",
681+
"faq-aa1b2fa31cd6205cdeb0e1b972a20584",
682+
"faq-aa1b2fa31cd6205cdeb0e1b972a20584-heading-faq-aa1b2fa31cd6205cdeb0e1b972a20584",
683+
"faq-aa1b2fa31cd6205cdeb0e1b972a20584-item-0",
684+
"faq-aa1b2fa31cd6205cdeb0e1b972a20584-item-1",
685+
"faq-aa1b2fa31cd6205cdeb0e1b972a20584-item-2",
689686
"fas-1",
690687
"fas-2",
691688
"fas-3",
692689
"fas-address-card",
693690
"fas-angle-left",
694-
"fas-angle-right",
695-
"fas-angles-left",
696-
"fas-angles-right",
697691
"fas-arrow-left",
698692
"fas-arrow-right",
699693
"fas-chevron-right",
@@ -779,11 +773,11 @@
779773
"nav-0-btn-1",
780774
"nav-0-btn-2",
781775
"nav-nav-0",
782-
"nav-panel-0e0d7c1fd6d33e3180b75a3f126f5fea",
783-
"nav-panel-3afb6d66b09dfeb4621548fc9812ce10",
784-
"nav-panel-46f581d5bacea14d68114161d503d5c1",
785-
"nav-panel-e37d2a3ed3fbb2ae9956fe2816627070",
786-
"nav-panel-effd2deef2e0cded9c2d41c8aaec9646",
776+
"nav-panel-4bb40e55576372d7d5033b3cb5988c2c",
777+
"nav-panel-6dfba858bf9eaea88ebc32de712ebf3f",
778+
"nav-panel-6fe204644b3fccca0d62ab3b712bf1cd",
779+
"nav-panel-b8350cafdd51c4d33847172721da9800",
780+
"nav-panel-e25d76a286385f8669a497412d250185",
787781
"navbar",
788782
"navbar-0-collapse",
789783
"navbar-mode",
@@ -792,36 +786,36 @@
792786
"navigation",
793787
"notification",
794788
"overview",
795-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-0",
796-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-1",
797-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-2",
798-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-btn-0",
799-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-btn-1",
800-
"panel-0e0d7c1fd6d33e3180b75a3f126f5fea-btn-2",
801-
"panel-3afb6d66b09dfeb4621548fc9812ce10-0",
802-
"panel-3afb6d66b09dfeb4621548fc9812ce10-1",
803-
"panel-3afb6d66b09dfeb4621548fc9812ce10-2",
804-
"panel-3afb6d66b09dfeb4621548fc9812ce10-btn-0",
805-
"panel-3afb6d66b09dfeb4621548fc9812ce10-btn-1",
806-
"panel-3afb6d66b09dfeb4621548fc9812ce10-btn-2",
807-
"panel-46f581d5bacea14d68114161d503d5c1-0",
808-
"panel-46f581d5bacea14d68114161d503d5c1-1",
809-
"panel-46f581d5bacea14d68114161d503d5c1-2",
810-
"panel-46f581d5bacea14d68114161d503d5c1-btn-0",
811-
"panel-46f581d5bacea14d68114161d503d5c1-btn-1",
812-
"panel-46f581d5bacea14d68114161d503d5c1-btn-2",
813-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-0",
814-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-1",
815-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-2",
816-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-btn-0",
817-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-btn-1",
818-
"panel-e37d2a3ed3fbb2ae9956fe2816627070-btn-2",
819-
"panel-effd2deef2e0cded9c2d41c8aaec9646-0",
820-
"panel-effd2deef2e0cded9c2d41c8aaec9646-1",
821-
"panel-effd2deef2e0cded9c2d41c8aaec9646-2",
822-
"panel-effd2deef2e0cded9c2d41c8aaec9646-btn-0",
823-
"panel-effd2deef2e0cded9c2d41c8aaec9646-btn-1",
824-
"panel-effd2deef2e0cded9c2d41c8aaec9646-btn-2",
789+
"panel-4bb40e55576372d7d5033b3cb5988c2c-0",
790+
"panel-4bb40e55576372d7d5033b3cb5988c2c-1",
791+
"panel-4bb40e55576372d7d5033b3cb5988c2c-2",
792+
"panel-4bb40e55576372d7d5033b3cb5988c2c-btn-0",
793+
"panel-4bb40e55576372d7d5033b3cb5988c2c-btn-1",
794+
"panel-4bb40e55576372d7d5033b3cb5988c2c-btn-2",
795+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-0",
796+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-1",
797+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-2",
798+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-btn-0",
799+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-btn-1",
800+
"panel-6dfba858bf9eaea88ebc32de712ebf3f-btn-2",
801+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-0",
802+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-1",
803+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-2",
804+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-btn-0",
805+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-btn-1",
806+
"panel-6fe204644b3fccca0d62ab3b712bf1cd-btn-2",
807+
"panel-b8350cafdd51c4d33847172721da9800-0",
808+
"panel-b8350cafdd51c4d33847172721da9800-1",
809+
"panel-b8350cafdd51c4d33847172721da9800-2",
810+
"panel-b8350cafdd51c4d33847172721da9800-btn-0",
811+
"panel-b8350cafdd51c4d33847172721da9800-btn-1",
812+
"panel-b8350cafdd51c4d33847172721da9800-btn-2",
813+
"panel-e25d76a286385f8669a497412d250185-0",
814+
"panel-e25d76a286385f8669a497412d250185-1",
815+
"panel-e25d76a286385f8669a497412d250185-2",
816+
"panel-e25d76a286385f8669a497412d250185-btn-0",
817+
"panel-e25d76a286385f8669a497412d250185-btn-1",
818+
"panel-e25d76a286385f8669a497412d250185-btn-2",
825819
"persona",
826820
"pie-chart",
827821
"pills",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/gethinode/mod-lottie v1.6.1 // indirect
1616
github.com/gethinode/mod-mermaid/v3 v3.0.1 // indirect
1717
github.com/gethinode/mod-simple-datatables/v2 v2.0.2 // indirect
18-
github.com/gethinode/mod-utils/v4 v4.14.0 // indirect
18+
github.com/gethinode/mod-utils/v4 v4.15.0 // indirect
1919
github.com/nextapps-de/flexsearch v0.0.0-20250907103239-defb38b083f0 // indirect
2020
github.com/twbs/bootstrap v5.3.8+incompatible // indirect
2121
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ github.com/gethinode/mod-utils/v4 v4.13.0 h1:VKAA+wKy4saayXfgJuVBRfhNVWQWmxOjO8L
506506
github.com/gethinode/mod-utils/v4 v4.13.0/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
507507
github.com/gethinode/mod-utils/v4 v4.14.0 h1:CF5dy+HWg22L306bWVhClWK9b1NVinEqtb4Qr2vcl9A=
508508
github.com/gethinode/mod-utils/v4 v4.14.0/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
509+
github.com/gethinode/mod-utils/v4 v4.15.0 h1:Zocy3qEVluYcx9te7bN6Serwp49kjhuH+eIvcCYpeC8=
510+
github.com/gethinode/mod-utils/v4 v4.15.0/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
509511
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo=
510512
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU=
511513
github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg=

0 commit comments

Comments
 (0)