Skip to content

Commit 883d753

Browse files
authored
Merge pull request #1586 from gethinode/develop
feat: enhance more button configuration
2 parents fe05770 + 221edc3 commit 883d753

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ blueprint:
2727
more:
2828
title:
2929
link:
30+
link-type:
31+
icon:
3032
icon-rounded:
3133
icon-style:
3234
cols:

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@
4949
{{ $moreButton := site.Params.modules.bookshop.articles.moreButton | default false }}
5050
{{ $moreTitle := T "more" (pluralize $args.input.section) }}
5151
{{ $moreLink := $args.input.section }}
52+
{{ $moreType := "button" }}
53+
{{ $moreIcon := "" }}
5254
{{ with $args.more }}
5355
{{ if .title }}{{ $moreTitle = .title }}{{ end }}
5456
{{ if .link }}{{ $moreLink = .link }}{{ end }}
57+
{{ if index . "link-type" }}{{ $moreType = index . "link-type" }}{{ end }}
58+
{{ if .icon }}{{ $moreIcon = .icon }}{{ end }}
5559
{{ end }}
5660

5761
{{ $paginate := $args.paginate }}
@@ -76,15 +80,17 @@
7680
{{ $partial := "assets/card-group.html" }}
7781
{{ $params := dict }}
7882
{{- $params = merge $params (dict
79-
"page" page
80-
"list" $pages
81-
"limit" $args.limit
82-
"cols" $args.cols
83-
"icon-rounded" $args.iconRounded
84-
"icon-style" $args.iconStyle
85-
"href" (cond $moreButton $moreLink "")
86-
"href-title" (cond $moreButton $moreTitle "")
87-
"href-force" (gt $result.total (len $result.pages))
83+
"page" page
84+
"list" $pages
85+
"limit" $args.limit
86+
"cols" $args.cols
87+
"icon-rounded" $args.iconRounded
88+
"icon-style" $args.iconStyle
89+
"href" (cond $moreButton $moreLink "")
90+
"href-title" (cond $moreButton $moreTitle "")
91+
"href-force" (gt $result.total (len $result.pages))
92+
"more-link-type" $moreType
93+
"more-link-icon" $moreIcon
8894
)}}
8995

9096
{{ if $args.scroll }}

data/structures/card-group.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ arguments:
6969
release: v0.27.0
7070
button-label:
7171
release: v1.0.0
72+
more-link-type:
73+
type: select
74+
optional: true
75+
default: button
76+
comment: Style of the more button or link.
77+
options:
78+
values:
79+
- button
80+
- link
81+
release: v1.16.0
82+
more-link-icon:
83+
type: string
84+
optional: true
85+
comment: >-
86+
Icon to include. You can use shorthand notation such as `fas sort` to
87+
include a Font Awesome icon. The argument also supports files with an
88+
`.svg` or `.json` extension.
89+
release: v1.16.0
7290

7391
# deprecated arguments
7492
header:

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.16.1 // indirect
18+
github.com/gethinode/mod-utils/v4 v4.17.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
@@ -516,6 +516,8 @@ github.com/gethinode/mod-utils/v4 v4.16.0 h1:yroLCeQyE/xU46YIKS81ZtFsOONTmVudrv2
516516
github.com/gethinode/mod-utils/v4 v4.16.0/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
517517
github.com/gethinode/mod-utils/v4 v4.16.1 h1:HjV6TONU7ZbXC2xZIPRupjKOUORddtQH8bb4dnULY1U=
518518
github.com/gethinode/mod-utils/v4 v4.16.1/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
519+
github.com/gethinode/mod-utils/v4 v4.17.0 h1:nDyXpZ0mCtf3ZML8G6bjeYJsI7Ne/Ze8rEWEa9zh6CI=
520+
github.com/gethinode/mod-utils/v4 v4.17.0/go.mod h1:bYmvRdAo4ICy5MpSGafDvO4p5bTDpsDKFCPL3bH0mN4=
519521
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo=
520522
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU=
521523
github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg=

layouts/_partials/assets/card-group.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
{{- $cardWrapper = printf "card-block card-block-%d" (int $size) -}}
172172
{{- end -}}
173173

174-
{{/*add col-$width */}}
174+
{{/* add col-$width */}}
175175
<div class="{{ with $cardWrapper }}{{ . }}{{ else }}col{{ end }}">
176176
{{- if $args.spacer -}}<div class="spacer"></div>{{ end -}}
177177
{{- partial $args.hook $params -}}
@@ -197,9 +197,14 @@
197197
{{- $href = printf "%s/" $href -}}
198198
{{- end -}}
199199
<div class="mt-{{ $padding.y }} w-100">
200-
<a class="btn btn-outline-primary" href="{{ $href | safeURL }}" role="button">
201-
{{ $args.hrefTitle }}
202-
</a>
200+
{{ partial "assets/button.html" (dict
201+
"href" $href
202+
"title" $args.hrefTitle
203+
"color" "primary"
204+
"outline" true
205+
"link-type" $args.moreLinkType
206+
"icon" $args.moreLinkIcon
207+
) }}
203208
</div>
204209
{{- end -}}
205210
{{- end -}}

0 commit comments

Comments
 (0)