-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathgrid.html
More file actions
210 lines (159 loc) · 3.53 KB
/
grid.html
File metadata and controls
210 lines (159 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{{/*
doc: Grids.
{{< grid columns="1 2 3 4" outline="true" >}}
[[item]]
type = ''
body = 'A'
[[item]]
type = ''
body = 'B'
[[item]]
type = ''
body = 'C'
[[item]]
type = ''
body = 'D'
{{< /grid >}}
{{< grid columns="1 2 2 4" >}}
[[item]]
type = 'card'
title = 'Only title'
[[item]]
type = 'card'
body = '''
Only body.
But with multiple text paragraphs.
'''
[[item]]
type = 'card'
title = 'Heading and body'
body = '''
Content of the third card.
{{< badge primary >}}Sample badge{{< /badge >}}
'''
[[item]]
type = 'card'
title = 'A card with a dropdown menu'
body = '''
{{< dropdown >}}
title = 'Click to expand dropdown'
icon = 'fa-solid fa-eye'
body = 'Hidden content'
{{< /dropdown >}}
'''
[[item]]
type = 'card'
header = 'Header'
title = 'Card Title'
body = 'Card content'
footer = 'Footer'
[[item]]
type = 'card'
header = 'A clickable image card'
link='https://example.com'
body='''
{{< image
src="https://images.unsplash.com/photo-1546238232-20216dec9f72"
alt="Cute puppies"
>}}
'''
[[item]]
type = 'card'
classcard = 'text-center'
link = 'https://example.com'
body = '''
{{< image
src="https://images.unsplash.com/photo-1546238232-20216dec9f72"
alt="Cute puppies"
>}}
A clickable figure card'''
[[item]]
type = 'card'
link = 'https://example.com'
body = '''
{{< image
src="https://images.unsplash.com/photo-1546238232-20216dec9f72"
alt="Cute puppies"
>}}
'''
footer = 'A clickable figure card'
{{< /grid >}}
{{< grid columns="2 2 2 2" >}}
[[item]]
type = 'card'
columns = "auto auto auto auto"
body = 'A'
[[item]]
type = 'card'
columns = "12 6 6 6"
body = 'B'
[[item]]
type = 'card'
columns = "12 12 12 12"
body = 'C'
{{< /grid >}}
Here's a grid with [gutters](https://sphinx-design.readthedocs.io/en/pydata-theme/grids.html#controlling-spacing-between-items).
A single value applies to all breakpoints.
{{< grid columns="1 2 3 4" gutter="1" >}}
[[item]]
type = 'card'
body = 'Tight spacing'
[[item]]
type = 'card'
body = 'Tight spacing'
[[item]]
type = 'card'
body = 'Tight spacing'
[[item]]
type = 'card'
body = 'Tight spacing'
{{< /grid >}}
Here's a grid with no gutters, which means no spacing between items.
{{< grid columns="2 2 2 2" gutter="0" >}}
[[item]]
type = 'card'
body = 'No spacing'
[[item]]
type = 'card'
body = 'No spacing'
{{< /grid >}}
Here's a grid with responsive gutters (i.e., "xs sm md lg" are set).
{{< grid columns="1 2 2 3" gutter="1 1 3 4" >}}
[[item]]
type = 'card'
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
[[item]]
type = 'card'
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
[[item]]
type = 'card'
body = 'Responsive gutter: 0.25rem on mobile, 1rem on tablet, 1.5rem on desktop'
{{< /grid >}}
And here's a grid with a large gutter, for more spacious layouts.
{{< grid columns="2 2 2 2" gutter="5" >}}
[[item]]
type = 'card'
body = 'Large spacing (3rem)'
[[item]]
type = 'card'
body = 'Large spacing (3rem)'
{{< /grid >}}
The parameters are based on sphinx-design system grid utilities, which is in-turn based on Bootstrap grid system. They are as follows:
- 0: 0 (no spacing)
- 1: 0.25rem
- 2: 0.5rem (default)
- 3: 1rem
- 4: 1.5rem
- 5: 3rem
*/}}
{{- $items := "" -}}
{{- with .Get "file" -}}
{{- with $.Page.Resources.Get . | transform.Unmarshal }}
{{- $items = (index . "item") }}
{{- else }}
{{- errorf "Unable to get page resource %q" . }}
{{- end }}
{{- else }}
{{- $items = (index (.Inner | transform.Unmarshal) "item") }}
{{- end }}
{{- partial "_elements/grid.html" (merge .Params (dict "items" $items)) -}}