generated from fastn-stack/fastn-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetail.ftd
203 lines (136 loc) · 3.9 KB
/
detail.ftd
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
-- import: fifthtry.github.io/bling/assets
-- import: fifthtry.github.io/package-doc/doc as pd
-- bling.page: `detail` and it's Usage
`-- detail` can be used as part of blog posts, OR inside page.
-- pd.package: `detail` and it's Usage
name: fifthtry.github.io/bling
`detail` is a new conversation experience via using `FTD` lang:
To use `detail` on your web package, add below into `FASTN.ftd` file:
-- cb.code:
lang: ftd
\-- fastn.dependency: fifthtry.github.io/bling
\-- fastn.auto-import: bling/detail as detail
-- tf.markdown:
Once you add above lines into your web package, add `detail` into your `.ftd`
files:
-- cb.code: Example code for `-- detail`
lang: ftd
\-- detail.detail: Lorem ipsum dolor
is-open: true
\-- tf.markdown:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt.
\-- cb.code: details
lang: ftd
\\-- detail.detail: Lorem ipsum dolor
is-open: true
\-- end: detail.detail
\-- detail.detail: Lorem ipsum dolor
\-- tf.markdown:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt.
\-- end: detail.detail
\-- detail.detail: 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
\-- end: detail.detail
-- tf.h3: Output of above example:
-- detail: Lorem ipsum dolor
$is-open: true
-- tf.markdown:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt.
-- cb.code: details
lang: ftd
\-- detail.detail: Lorem ipsum dolor
is-open: true
-- end: detail
-- detail: Lorem ipsum dolor
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt.
-- detail: 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
-- end: bling.page
-- component detail:
caption title:
optional string info-right:
boolean $is-open: false
optional body body:
optional ftd.image-src image:
integer width: 20
boolean $show-image: false
children container:
-- ftd.column:
spacing.fixed.px: 8
max-width.fixed.px: 800
padding.px: 12
width: fill-container
width if { $detail.info-right != NULL }: fill-container
margin-bottom.px: 20
color: $inherited.colors.text
-- ftd.row:
width: fill-container
spacing.fixed.px: 8
-- ftd.row:
width: fill-container
align-self: start
-- ftd.image:
if: { detail.image != NULL }
src: $detail.image
width.fixed.px: $detail.width
height: auto
margin-right.px: 12
-- ftd.column:
if: { detail.image == NULL }
$on-click$: $ftd.toggle($a = $detail.is-open)
-- ftd.text: ▶
if: { !detail.is-open }
padding-top.px: 2
role: $inherited.types.fine-print
color: $inherited.colors.text
width.fixed.px: 20
-- ftd.text: ▼
if: { detail.is-open }
role: $inherited.types.copy-small
color: $inherited.colors.text
width.fixed.px: 20
-- end: ftd.column
-- ftd.text: $detail.title
role: $inherited.types.copy-small
color: $inherited.colors.text
-- end: ftd.row
-- ftd.row:
width: hug-content
align-self: end
-- ftd.text: $detail.info-right
if: { $detail.info-right != NULL }
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: { $detail.is-open }
border-width.px: 1
border-color: $inherited.colors.border
background.solid: $inherited.colors.background.step-1
padding.px: 12
border-radius.px: 4
-- ftd.text: $detail.body
if: { $detail.body != NULL }
role: $inherited.types.label-large
color: $inherited.colors.text
-- ftd.column:
children: $detail.container
width: fill-container
-- end: ftd.column
-- end: ftd.column
-- end: ftd.column
-- end: detail