Skip to content

Commit

Permalink
Merge pull request #1229 from gethinode/develop
Browse files Browse the repository at this point in the history
Fix responsive behavior of card group
  • Loading branch information
markdumay authored Oct 10, 2024
2 parents 9b5c572 + c37fe75 commit c537b9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit c537b9c

Please sign in to comment.