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

Add grid columns option #490

Merged
merged 1 commit into from
Feb 18, 2024
Merged
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
31 changes: 11 additions & 20 deletions layouts/shortcodes/grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

doc: Grids.

{{< grid >}}
{{< grid columns="1 2 2 3">}}

{{< card >}}
title = 'Only title'
Expand All @@ -25,11 +25,6 @@
'''
{{< /card >}}

{{< /grid >}}


{{< grid >}}

{{< card >}}
title = 'A card with a dropdown menu'
body = '''
Expand All @@ -46,19 +41,6 @@
link = 'https://example.com'
{{< /card >}}

{{< /grid >}}


{{< grid >}}

{{< card >}}
header = 'Header'
title = 'Card Title'
body = 'Card content'
footer = 'Footer'
{{< /card >}}


{{< card >}}
header = 'Header'
title = 'Card Title'
Expand All @@ -71,7 +53,16 @@
*/}}

<div class="sd-container-fluid sd-mb-4">
<div class="sd-row">
{{- with .Get "columns" -}}
{{ $columns := split . " " }}
{{ $xs := index $columns 0 }}
{{ $sm := index $columns 1 }}
{{ $md := index $columns 2 }}
{{ $lg := index $columns 3 }}
<div class="sd-row sd-row-cols-1 sd-row-cols-xs-{{ $xs }} sd-row-cols-sm-{{ $sm }} sd-row-cols-md-{{ $md }} sd-row-cols-lg-{{ $lg }} sd-g-2 sd-g-xs-{{ $xs }} sd-g-sm-{{ $sm }} sd-g-md-{{ $md }} sd-g-lg-{{ $lg }}">
{{- else }}
<div class="sd-row">
{{- end }}
{{ .Inner }}
</div>
</div>