|
2 | 2 |
|
3 | 3 | doc: Create button links in various styles.
|
4 | 4 |
|
5 |
| -{{< button info >}} |
6 |
| -label: Info |
7 |
| -link: http://example.com/ |
8 |
| -{{< /button >}} |
9 |
| - |
10 |
| -{{< button success >}} |
11 |
| -label: Success |
12 |
| -link: http://example.com/ |
13 |
| -{{< /button >}} |
14 |
| - |
15 |
| -{{< button warning >}} |
16 |
| -label: Warning |
17 |
| -link: http://example.com/ |
18 |
| -{{< /button >}} |
19 |
| - |
20 |
| -{{< button danger >}} |
21 |
| -label: Danger |
22 |
| -link: http://example.com/ |
23 |
| -{{< /button >}} |
24 |
| - |
25 |
| -{{< button muted >}} |
26 |
| -label: Muted |
27 |
| -link: http://example.com/ |
28 |
| -{{< /button >}} |
29 |
| - |
30 |
| -{{< button light >}} |
31 |
| -label: Light |
32 |
| -link: http://example.com/ |
33 |
| -{{< /button >}} |
34 |
| - |
35 |
| -{{< button dark >}} |
36 |
| -label: Dark |
37 |
| -link: http://example.com/ |
38 |
| -{{< /button >}} |
| 5 | +{{< button |
| 6 | + style="info" |
| 7 | + label="Info" |
| 8 | + link="http://example.com/" >}} |
| 9 | + |
| 10 | +{{< button |
| 11 | + style="success" |
| 12 | + label="Success" |
| 13 | + link="http://example.com/" >}} |
| 14 | + |
| 15 | +{{< button |
| 16 | + style="warning" |
| 17 | + label="Warning" |
| 18 | + link="http://example.com/" >}} |
| 19 | + |
| 20 | +{{< button |
| 21 | + style="danger" |
| 22 | + label="Danger" |
| 23 | + link="http://example.com/" >}} |
| 24 | + |
| 25 | +{{< button |
| 26 | + style="muted" |
| 27 | + label="Muted" |
| 28 | + link="http://example.com/" >}} |
| 29 | + |
| 30 | +{{< button |
| 31 | + style="light" |
| 32 | + label="Light" |
| 33 | + link="http://example.com/" >}} |
| 34 | + |
| 35 | +{{< button |
| 36 | + style="dark" |
| 37 | + label="Dark" |
| 38 | + link="http://example.com/" >}} |
39 | 39 |
|
40 | 40 | <p>
|
41 | 41 |
|
42 |
| -{{< button outline-info >}} |
43 |
| -label: Info |
44 |
| -link: http://example.com/ |
45 |
| -{{< /button >}} |
46 |
| - |
47 |
| -{{< button outline-success >}} |
48 |
| -label: Success |
49 |
| -link: http://example.com/ |
50 |
| -{{< /button >}} |
51 |
| - |
52 |
| -{{< button outline-warning >}} |
53 |
| -label: Warning |
54 |
| -link: http://example.com/ |
55 |
| -{{< /button >}} |
56 |
| - |
57 |
| -{{< button outline-danger >}} |
58 |
| -label: Danger |
59 |
| -link: http://example.com/ |
60 |
| -{{< /button >}} |
61 |
| - |
62 |
| -{{< button outline-muted >}} |
63 |
| -label: Muted |
64 |
| -link: http://example.com/ |
65 |
| -{{< /button >}} |
66 |
| - |
67 |
| -{{< button outline-light >}} |
68 |
| -label: Light |
69 |
| -link: http://example.com/ |
70 |
| -{{< /button >}} |
71 |
| - |
72 |
| -{{< button outline-dark >}} |
73 |
| -label: Dark |
74 |
| -link: http://example.com/ |
75 |
| -{{< /button >}} |
| 42 | +{{< button |
| 43 | + style="outline-info" |
| 44 | + label="Info" |
| 45 | + link="http://example.com/" >}} |
| 46 | + |
| 47 | +{{< button |
| 48 | + style="outline-success" |
| 49 | + label="Success" |
| 50 | + link="http://example.com/" >}} |
| 51 | + |
| 52 | +{{< button |
| 53 | + style="outline-warning" |
| 54 | + label="Warning" |
| 55 | + link="http://example.com/" >}} |
| 56 | + |
| 57 | +{{< button |
| 58 | + style="outline-danger" |
| 59 | + label="Danger" |
| 60 | + link="http://example.com/" >}} |
| 61 | + |
| 62 | +{{< button |
| 63 | + style="outline-muted" |
| 64 | + label="Muted" |
| 65 | + link="http://example.com/" >}} |
| 66 | + |
| 67 | +{{< button |
| 68 | + style="outline-light" |
| 69 | + label="Light" |
| 70 | + link="http://example.com/" >}} |
| 71 | + |
| 72 | +{{< button |
| 73 | + style="outline-dark" |
| 74 | + label="Dark" |
| 75 | + link="http://example.com/" >}} |
76 | 76 |
|
77 | 77 | */}}
|
78 | 78 |
|
79 |
| -{{ $button_style := .Get 0 }} |
80 |
| -{{ $button_data := transform.Unmarshal .Inner }} |
81 |
| -{{ $button_label := $button_data.label }} |
82 |
| -{{ $button_link := $button_data.link }} |
| 79 | +{{- $button := dict -}} |
| 80 | +{{- range $key, $value := .Params -}} |
| 81 | +{{- $button = merge $button (dict $key $value) -}} |
| 82 | +{{- end -}} |
83 | 83 |
|
84 |
| -<a href="{{$button_link}}"><span class="sd-btn sd-btn-{{$button_style}}">{{$button_label}}</span></a> |
| 84 | +<a href="{{$button.link}}"><span class="sd-btn sd-btn-{{$button.style}}">{{$button.label}}</span></a> |
0 commit comments