This repository was archived by the owner on Jan 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcollapse.ftd
More file actions
178 lines (123 loc) · 4.04 KB
/
collapse.ftd
File metadata and controls
178 lines (123 loc) · 4.04 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
-- site-doc.doc-home: Collapse
site-title: Bling
show-tabs: false
github-url: https://github.com/fastn-community/bling
current-package: fastn-community.github.io/bling
The collapse component typically consists of a header and a collapsible body.
The header serves as a clickable element, such as a button or a title, that
triggers the collapse functionality.
-- site-doc.header: Example
-- site-doc.output:
colors: $ftd.default-colors
types: $ftd.default-types
-- collapse: Lorem ipsum dolor
info-right: Dolor sit amet
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut
-- end: site-doc.output
-- site-doc.header: How to use
-- cb.code: Add `bling` dependency into your FASTN.ftd
lang: ftd
\-- fastn.dependency: fastn-community.github.io/bling
-- cb.code: sample usage of `-- collapse` component
lang: ftd
\-- import: fastn-community.github.io/bling/collapse
\-- collapse.collapse: Lorem ipsum dolor
info-right: Some info at right side
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut
-- site-doc.header: Properties:
Below are details of all properties of `collapse` component.
-- site-doc.component-property: `title`
type: Caption (`required`)
It's used to add title which is clickable.
-- site-doc.component-property: `info-right`
type: String (`optional`)
It's used to show some info/text to the right corner of the title of collapse.
-- site-doc.component-property: `$is-open`
type: Boolean (`optional`, default: `false`)
It's used to show body content of collapse, default value is `false` if you set
it to `true` then body content will be visible.
-- site-doc.component-property: `remove-gap`
type: Boolean (`optional`, default: `false`)
It's used to remove bottom margin between two collapse components, default value
is `false` if you set it to `true` then bottom margin of collapse will be
removed.
-- site-doc.component-property: `body`
type: Body (`optional`)
It's used to add body content to collapse component.
-- end: site-doc.doc-home
-- component collapse:
caption title:
optional string info-right:
boolean $is-open: false
optional body body:
children container:
boolean remove-gap: false
-- ftd.column:
width: fill-container
width if { $collapse.info-right != NULL }: fill-container
margin-bottom.px if { !collapse.remove-gap }: 20
color: $inherited.colors.text
border-color: $inherited.colors.border
border-width.px: 1
border-radius.px: 6
-- ftd.row:
width: fill-container
spacing.fixed.px: 28
spacing.fixed.px if { ftd.device == "mobile" }: 12
$on-click$: $ftd.toggle($a = $collapse.is-open)
padding.px: 8
wrap if { ftd.device == "mobile" }: true
-- ftd.row:
width: fill-container
align-self: start
-- ftd.image:
if: { !collapse.is-open }
src: $assets.files.static.right-arrow.svg
align-self: center
width.fixed.px: 12
margin-right.px: 16
-- ftd.image:
if: { collapse.is-open }
src: $assets.files.static.down-arrow.svg
align-self: center
width.fixed.px: 12
margin-right.px: 16
-- ftd.text: $collapse.title
role: $inherited.types.copy-small
color: $inherited.colors.text
-- end: ftd.row
-- ftd.row:
if: { $collapse.info-right != NULL }
width: hug-content
align-self: center
margin-left.px if { ftd.device == "mobile" }: 28
-- ftd.text: $collapse.info-right
role: $inherited.types.copy-small
color: $inherited.colors.text
white-space: nowrap
align-self: end
-- end: ftd.row
-- end: ftd.row
-- ftd.column:
width: fill-container
if: { $collapse.is-open }
border-top-width.px: 1
border-color: $inherited.colors.border
padding.px: 12
border-bottom-left-radius.px: 6
border-bottom-right-radius.px: 6
-- ftd.text: $collapse.body
if: { $collapse.body != NULL }
role: $inherited.types.label-large
color: $inherited.colors.text
-- ftd.column:
children: $collapse.container
width: fill-container
-- end: ftd.column
-- end: ftd.column
-- end: ftd.column
-- end: collapse