|
2 | 2 |
|
3 | 3 | doc: Grids. |
4 | 4 |
|
5 | | -{{< grid1 columns="1 2 2 4">}} |
| 5 | +{{< grid1 columns="1 2 3 4" >}} |
6 | 6 |
|
7 | | -[[card]] |
| 7 | +[[item]] |
| 8 | +type = '' |
| 9 | +body = 'A' |
| 10 | + |
| 11 | +[[item]] |
| 12 | +type = '' |
| 13 | +body = 'B' |
| 14 | + |
| 15 | +[[item]] |
| 16 | +type = '' |
| 17 | +body = 'C' |
| 18 | + |
| 19 | +[[item]] |
| 20 | +type = '' |
| 21 | +body = 'D' |
| 22 | + |
| 23 | +{{< /grid1 >}} |
| 24 | + |
| 25 | +{{< grid1 columns="1 2 2 4" >}} |
| 26 | + |
| 27 | +[[item]] |
| 28 | +type = 'card' |
8 | 29 | title = 'Only title' |
9 | 30 |
|
10 | | -[[card]] |
| 31 | +[[item]] |
| 32 | +type = 'card' |
11 | 33 | body = ''' |
12 | 34 | Only body. |
13 | 35 |
|
14 | 36 | But with multiple text paragraphs. |
15 | 37 | ''' |
16 | 38 |
|
17 | | -[[card]] |
| 39 | +[[item]] |
| 40 | +type = 'card' |
18 | 41 | title = 'Heading and body' |
19 | 42 | body = ''' |
20 | 43 | Content of the third card. |
21 | 44 |
|
22 | 45 | {{< badge primary >}}Sample badge{{< /badge >}} |
23 | 46 | ''' |
24 | 47 |
|
25 | | -[[card]] |
| 48 | +[[item]] |
| 49 | +type = 'card' |
26 | 50 | title = 'A card with a dropdown menu' |
27 | 51 | body = ''' |
28 | 52 | {{< dropdown >}} |
|
32 | 56 | {{< /dropdown >}} |
33 | 57 | ''' |
34 | 58 |
|
35 | | -[[card]] |
| 59 | +[[item]] |
| 60 | +type = 'card' |
36 | 61 | header = 'Header' |
37 | 62 | title = 'Card Title' |
38 | 63 | body = 'Card content' |
39 | 64 | footer = 'Footer' |
40 | 65 |
|
41 | | -[[card]] |
| 66 | +[[item]] |
| 67 | +type = 'card' |
42 | 68 | header = 'A clickable image card' |
43 | 69 | link = 'https://example.com' |
44 | 70 | body = '''{{< image >}} |
|
47 | 73 | align = 'center' |
48 | 74 | {{< /image >}}''' |
49 | 75 |
|
50 | | -[[card]] |
| 76 | +[[item]] |
| 77 | +type = 'card' |
51 | 78 | header = 'A clickable figure card' |
52 | 79 | link = 'https://example.com' |
53 | 80 | body = '''{{< figure |
54 | 81 | src="https://source.unsplash.com/200x200/daily?cute+puppy" |
55 | 82 | alt="Cute puppies" |
56 | 83 | >}}''' |
57 | 84 |
|
58 | | -[[card]] |
| 85 | +[[item]] |
| 86 | +type = 'card' |
59 | 87 | link = 'https://example.com' |
60 | 88 | body = '''{{< figure |
61 | 89 | src="https://source.unsplash.com/200x200/daily?cute+puppy" |
|
68 | 96 | */}} |
69 | 97 |
|
70 | 98 | <div class="sd-container-fluid sd-mb-4"> |
71 | | -{{ $cards := "" }} |
72 | 99 | {{- with .Get "columns" -}} |
73 | 100 | {{ $columns := split . " " }} |
74 | 101 | {{ $xs := index $columns 0 }} |
|
79 | 106 | {{- else }} |
80 | 107 | <div class="sd-row sd-row-cols-auto sd-row-cols-xs-auto sd-row-cols-sm-auto sd-row-cols-md-auto sd-row-cols-lg-auto"> |
81 | 108 | {{- end }} |
| 109 | +{{ $items := "" }} |
82 | 110 | {{- with .Get "file" -}} |
83 | 111 | {{ with $.Page.Resources.Get . | transform.Unmarshal }} |
84 | | - {{ $cards = (index . "card") }} |
| 112 | + {{ $items = (index . "item") }} |
85 | 113 | {{ else }} |
86 | 114 | {{ errorf "Unable to get page resource %q" . }} |
87 | 115 | {{ end }} |
88 | 116 | {{- else }} |
89 | | - {{ $cards = (index (.Inner | transform.Unmarshal) "card") }} |
| 117 | + {{ $items = (index (.Inner | transform.Unmarshal) "item") }} |
90 | 118 | {{- end }} |
91 | | -{{- range $key, $d := $cards -}} |
| 119 | +{{- range $key, $d := $items -}} |
| 120 | +{{ if eq $d.type "card" }} |
92 | 121 | <div class="sd-col sd-d-flex-row"> |
93 | 122 | {{- with $d.link }} |
94 | 123 | <div class="sd-card sd-w-100 sd-shadow-sm sd-card-hover"> |
|
120 | 149 | {{- end }} |
121 | 150 | </div> |
122 | 151 | </div> |
| 152 | +{{ else }} |
| 153 | + <div class="sd-col sd-d-flex-column"> |
| 154 | + <p> |
| 155 | + {{- with (trim .body "\n") }} |
| 156 | + {{ . | markdownify }} |
| 157 | + {{- end }} |
| 158 | + </p> |
| 159 | + </div> |
| 160 | +{{ end }} |
123 | 161 | {{- end }} |
124 | 162 | </div> |
125 | 163 | </div> |
0 commit comments