Compare commits

...

6 Commits

Author SHA1 Message Date
Mark Dumay
75373935f1 Merge pull request #734 from gethinode/develop
Extend card style configuration
2024-01-27 09:59:27 +01:00
Mark Dumay
1d5784a4d1 Merge branch 'main' into develop 2024-01-27 07:28:33 +01:00
Mark Dumay
5df94ffe33 Extend card-group args 2024-01-27 07:26:17 +01:00
Mark Dumay
6aeaa8812a Bump package release 2024-01-27 07:15:19 +01:00
Mark Dumay
b1f8044e02 Update build stats 2024-01-27 07:15:09 +01:00
Mark Dumay
09fc0991bd Extend card args 2024-01-27 07:15:00 +01:00
8 changed files with 69 additions and 17 deletions

View File

@@ -157,19 +157,39 @@ arguments:
optional: true optional: true
comment: >- comment: >-
Font Awesome icon, displayed on top or the left of the card. Font Awesome icon, displayed on top or the left of the card.
align:
type: select
optional: true
default: start
release: v0.23.0-alpha2
comment: Icon alignment.
options:
values:
- start
- end
- center
style:
type: string
optional: true
release: v0.23.0-alpha2
comment: Icon style.
orientation: orientation:
type: select type: select
optional: true optional: true
default: stacked default: stacked
parent: cascade parent: cascade
comment: >- comment: Placement of the thumbnail or icon.
Placement of the thumbnail or icon.
options: options:
values: values:
- stacked - stacked
- horizontal - horizontal
- horizontal-sm - horizontal-sm
- none - none
subtle:
type: bool
optional: true
release: v0.23.0-alpha2
comment: Apply subtle background colors.
body: body:
optional: true optional: true
comment: >- comment: >-

View File

@@ -26,7 +26,6 @@
"mark", "mark",
"meta", "meta",
"nav", "nav",
"nil",
"noscript", "noscript",
"ol", "ol",
"p", "p",
@@ -63,6 +62,7 @@
"alert-dismissible", "alert-dismissible",
"align-items-center", "align-items-center",
"align-items-end", "align-items-end",
"align-items-start",
"align-middle", "align-middle",
"align-self-center", "align-self-center",
"align-self-end", "align-self-end",
@@ -126,13 +126,11 @@
"col-3", "col-3",
"col-4", "col-4",
"col-6", "col-6",
"col-8",
"col-9", "col-9",
"col-auto", "col-auto",
"col-lg-2", "col-lg-2",
"col-lg-4", "col-lg-4",
"col-lg-8", "col-lg-8",
"col-md-10",
"col-md-2", "col-md-2",
"col-md-3", "col-md-3",
"col-md-4", "col-md-4",

View File

@@ -27,6 +27,9 @@
{{- $orientation := .orientation -}} {{- $orientation := .orientation -}}
{{- $ratio := .ratio -}} {{- $ratio := .ratio -}}
{{- $wrapper := .wrapper | default "p-0" -}} {{- $wrapper := .wrapper | default "p-0" -}}
{{- $style := .style -}}
{{- $align := .align -}}
{{- $subtle := .subtle }}
{{- $loading := .loading -}} {{- $loading := .loading -}}
<!-- Override arguments --> <!-- Override arguments -->
@@ -90,6 +93,9 @@
"orientation" $orientation "orientation" $orientation
"padding" $padding "padding" $padding
"ratio" $ratio "ratio" $ratio
"subtle" $subtle
"style" $style
"align" $align
) -}} ) -}}
{{- $params = merge $params $element }} {{- $params = merge $params $element }}
@@ -102,7 +108,7 @@
</div> </div>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- print $cards | safeHTML }} {{if $cards }}{{- print $cards | safeHTML }}{{ end }}
</div> </div>
{{ if $paginate }} {{ if $paginate }}

View File

@@ -19,12 +19,24 @@
{{- $header := .header | default "full" -}} {{- $header := .header | default "full" -}}
{{- $href := .href -}} {{- $href := .href -}}
{{- $icon := .icon -}} {{- $icon := .icon -}}
{{- $iconStyle := "" -}}
{{- $align := .align | default "start" -}}
{{- $style := .style | default "" -}}
{{- $loading := .loading -}} {{- $loading := .loading -}}
{{- $orientation := .orientation | default "stacked" -}} {{- $orientation := .orientation | default "stacked" -}}
{{- $padding := .padding | default "auto" -}} {{- $padding := .padding | default "auto" -}}
{{- $ratio := .ratio -}} {{- $ratio := .ratio -}}
{{- $thumbnail := .thumbnail -}} {{- $thumbnail := .thumbnail -}}
{{- $title := .title -}} {{- $title := .title -}}
{{- $subtle := .subtle -}}
{{- $colorStyle := "" -}}
{{ if $color }}
{{ if $subtle }}
{{- $colorStyle = printf "bg-%s-subtle text-%s-emphasis" $color $color -}}
{{ else }}
{{- $colorStyle = printf "bg-%s text-bg-%s" $color $color -}}
{{ end }}
{{ end }}
<!-- Override arguments --> <!-- Override arguments -->
{{- $page := "" }} {{- $page := "" }}
@@ -42,6 +54,13 @@
{{- if not $icon }}{{ $icon = .Params.icon }}{{ end -}} {{- if not $icon }}{{ $icon = .Params.icon }}{{ end -}}
{{- end -}} {{- end -}}
{{ if (hasPrefix $orientation "horizontal") }}
{{ if not $style }}{{ $style = "fa-fluid fa-fw" }}{{ end }}
{{ else }}
{{ if not $style }}{{ $style = "fa-4x" }}{{ end }}
{{- $iconStyle = "pb-3" -}}
{{ end }}
{{- if eq $orientation "none" }}{{ $thumbnail = "" }}{{ $icon = "" }}{{ end -}} {{- if eq $orientation "none" }}{{ $thumbnail = "" }}{{ $icon = "" }}{{ end -}}
<!-- Inline partial to render the card's body --> <!-- Inline partial to render the card's body -->
@@ -100,18 +119,18 @@
{{- if hasPrefix $orientation "horizontal" -}} {{- if hasPrefix $orientation "horizontal" -}}
<!-- Render horizontal card --> <!-- Render horizontal card -->
<div class="card {{ with $color }}bg-{{ . }} text-bg-{{ . }}{{ end }} {{ $class }}"> <div class="card {{ $colorStyle }} {{ $class }}">
<div class="row g-0 row-cols-1 h-100"> <div class="row g-0 row-cols-1 h-100">
<div class="col-4{{ if eq $orientation "horizontal-sm" }} col-md-2{{ end }}"> <div class="{{ if eq $orientation "horizontal-sm" }}col-2{{ else }}col-4{{ end }}">
{{- if $thumbnail -}} {{- if $thumbnail -}}
{{- partial "assets/image.html" (dict "url" $thumbnail "ratio" (or $ratio "1x1") "wrapper" "h-100 card-img-wrap" "class" "rounded-start card-img-h100" "title" $title "loading" $loading) -}} {{- partial "assets/image.html" (dict "url" $thumbnail "ratio" (or $ratio "1x1") "wrapper" "h-100 card-img-wrap" "class" "rounded-start card-img-h100" "title" $title "loading" $loading) -}}
{{- else if $icon -}} {{- else if $icon -}}
<div class="card-icon p-{{ $padding }} h-100 fa-wrapper d-flex align-items-center justify-content-center"> <div class="card-icon p-{{ $padding }} h-100 fa-wrapper d-flex align-items-{{ $align}} justify-content-center {{ $iconStyle }}">
{{- partial "assets/icon.html" (dict "icon" (printf "%s fa-fluid fa-fw" $icon)) -}} {{- partial "assets/icon.html" (dict "icon" (printf "%s %s" $icon $style)) -}}
</div> </div>
{{- end -}} {{- end -}}
</div> </div>
<div class="col-8{{ if eq $orientation "horizontal-sm" }} col-md-10{{ end }}"> <div class="{{ if eq $orientation "horizontal-sm" }}col-10{{ else }}col-8{{ end }}">
<div class="card-body d-flex p-{{ $padding }} flex-column h-100"> <div class="card-body d-flex p-{{ $padding }} flex-column h-100">
{{ if $page }}<div>{{ partial "card-caption.html" (dict "page" $page "keywords" $header "color" $color) }}</div>{{ end }} {{ if $page }}<div>{{ partial "card-caption.html" (dict "page" $page "keywords" $header "color" $color) }}</div>{{ end }}
<div class="h-100"> <div class="h-100">
@@ -124,12 +143,12 @@
</div> </div>
{{- else -}} {{- else -}}
<!-- Render stacked / default card --> <!-- Render stacked / default card -->
<div class="card {{ with $color }}bg-{{ . }} text-bg-{{ . }}{{ end }} {{ $class }}"> <div class="card {{ $colorStyle }} {{ $class }} text-{{ $align }}">
{{- if $thumbnail -}} {{- if $thumbnail -}}
{{- partial "assets/image.html" (dict "url" $thumbnail "ratio" (or $ratio "16x9") "wrapper" "card-img-wrap" "class" "card-img-top" "title" (or $alt $title) "loading" $loading) -}} {{- partial "assets/image.html" (dict "url" $thumbnail "ratio" (or $ratio "16x9") "wrapper" "card-img-wrap" "class" "card-img-top" "title" (or $alt $title) "loading" $loading) -}}
{{- else if $icon -}} {{- else if $icon -}}
<div class="card-icon p-{{ $padding }}"> <div class="card-icon p-{{ $padding }} {{ $iconStyle }} text-{{ $align }}">
{{- partial "assets/icon.html" (dict "icon" (printf "%s fa-4x" $icon)) -}} {{- partial "assets/icon.html" (dict "icon" (printf "%s %s" $icon $style)) -}}
</div> </div>
{{- end -}} {{- end -}}
<div class="card-body d-flex flex-column p-{{ $padding }}"> <div class="card-body d-flex flex-column p-{{ $padding }}">

View File

@@ -24,6 +24,9 @@
{{- $header := .Get "header" | default "" -}} {{- $header := .Get "header" | default "" -}}
{{- $footer := .Get "footer" | default "" -}} {{- $footer := .Get "footer" | default "" -}}
{{- $orientation := .Get "orientation" | default "" -}} {{- $orientation := .Get "orientation" | default "" -}}
{{- $align := .Get "align" | default "start" -}}
{{- $style := .Get "style" | default "" -}}
{{- $subtle := .Get "subtle" | default false -}}
{{ $inner := .Scratch.Get "inner" }} {{ $inner := .Scratch.Get "inner" }}
{{ $input := trim .Inner " \r\n" }} {{ $input := trim .Inner " \r\n" }}

View File

@@ -21,6 +21,9 @@
{{- $gutter := partial "utilities/GetArgParent" (dict "page" . "arg" "gutter") | default "0" -}} {{- $gutter := partial "utilities/GetArgParent" (dict "page" . "arg" "gutter") | default "0" -}}
{{- $header := partial "utilities/GetArgParent" (dict "page" . "arg" "header") | default "full" -}} {{- $header := partial "utilities/GetArgParent" (dict "page" . "arg" "header") | default "full" -}}
{{- $icon := .Get "icon" -}} {{- $icon := .Get "icon" -}}
{{- $align := partial "utilities/GetArgParent" (dict "page" . "arg" "align") | default "start" -}}
{{- $style := partial "utilities/GetArgParent" (dict "page" . "arg" "style") | default "" -}}
{{- $subtle := partial "utilities/GetArgParent" (dict "page" . "arg" "subtle") | default false -}}
{{- $loading := .Get "loading" -}} {{- $loading := .Get "loading" -}}
{{- $orientation := partial "utilities/GetArgParent" (dict "page" . "arg" "orientation") | default "stacked" -}} {{- $orientation := partial "utilities/GetArgParent" (dict "page" . "arg" "orientation") | default "stacked" -}}
{{- $padding := partial "utilities/GetArgParent" (dict "page" . "arg" "padding") | default "auto" -}} {{- $padding := partial "utilities/GetArgParent" (dict "page" . "arg" "padding") | default "auto" -}}
@@ -59,6 +62,9 @@
"description" $description "description" $description
"ratio" $ratio "ratio" $ratio
"icon" $icon "icon" $icon
"align" $align
"style" $style
"subtle" $subtle
"thumbnail" $thumbnail "thumbnail" $thumbnail
"loading" $loading "loading" $loading
"alt" $alt "alt" $alt

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.23.0-alpha", "version": "0.23.0-alpha2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.23.0-alpha", "version": "0.23.0-alpha2",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0", "@fullhuman/postcss-purgecss": "^5.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.23.0-alpha", "version": "0.23.0-alpha2",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [ "keywords": [
"hugo", "hugo",