Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix responsive behavior of card group #1229

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/server.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# toml-docs-start server-config
[[headers]]
for = "/**"
[headers.values]
Expand Down Expand Up @@ -37,3 +38,4 @@
manifest-src 'self'; \
media-src 'self' \
"""
# toml-docs-end server-config
7 changes: 6 additions & 1 deletion layouts/partials/assets/card-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"5" (printf "(min-width: %s) 20vw, (min-width: %s) 33.3vw, 100vw" $breakpoint.currentSize $breakpoint.prevSize)
}}

{{ if not $args.responsive }}
{{ $colsMap = dict "auto" "" "1" "row-cols-1" "2" "row-cols-2" "3" "row-cols-3" "4" "row-cols-4" "5" "row-cols-5" }}
{{ $sizesMap = dict "auto" "100vw" "1" "100vw" "2" "50vw" "3" "33.3vw" "4" "25vw" "5" "20vw" }}
{{ end }}

<!-- Apply optional pagination -->
{{ $isPages := in (slice "page.Pages" "resource.Resources") (printf "%T" $list) }}
{{ $paginator := "" }}
Expand Down Expand Up @@ -103,7 +108,7 @@
{{- $colGrid := "" -}}
{{ if not $args.scroll }}
{{ $colGrid = index $colsMap $args.cols }}
{{ if $args.responsive }}{{ $sizes = index $sizesMap $args.cols }}{{ end }}
{{ $sizes = index $sizesMap $args.cols }}
{{ else }}
{{ if in (slice "2" "3" "4" "5") $args.cols }}
{{ $sizes = replace (printf "%.1fvw" (div 100.0 (int $args.cols))) ".0" "" }}
Expand Down