generated from fastn-stack/fastn-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ftd
186 lines (111 loc) · 3.27 KB
/
index.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
-- import: fifthtry.github.io/doc-site as ds
-- import: gargajit.github.io/expander/assets
-- import: fifthtry.github.io/forest-cs
-- import: fifthtry.github.io/admonitions as cbox
-- ds.page: Polished Page
site-logo: $assets.files.images.logo.svg
colors: $forest-cs.main
In this video we are going to polish our `expander project` and
We are going to do the following:
- Use featured components
- replace `ftd.text` icons on header with images of arrows
- add `on-mouse` event handlers
- add buttons by creating a component
-- ds.h1: About Expander
`Expander` is a package which has a component called `box`.
This box has a `header area` and a `body area`.
One can expand or collapse the body area when clicked on the
header area. It takes user defined content or it also has a default text.
-- ds.markdown:
Box can have user-defined values or it can have default values as well.
Following are the two boxes:
-- box: What is FTD?
FTD is the innovative programming language for writing prose.
Say goodbye to the complexities of traditional programming languages
and hello to a simplified and intuitive experience.
FTD language is designed for human beings, not just
programmers, we have taken precautions like not
requiring quoting for strings, not relying on
indentation nor on braces that most programming
languages require.
-- ds.markdown:
This box gives `default values`.
-- box:
-- ds.markdown:
This looks much better. We can do a lot more.
-- cbox.tip: Tip!
`Doc-site` has a dark-mode switcher on the bottom-right
side of the web-page.
-- end: cbox.tip
-- end: ds.page
-- component box:
caption title: Default Header
body body: Default Body
boolean $open: false
boolean $over: false
ftd.color headercolor: $header-text-color
ftd.color bordercolor: $border-color
ftd.color bodycolor: $body-text-color
ftd.color hovercolor: $hover-color
optional ftd.color bg-header: $bg-header
optional ftd.color bg-body: $bg-body
;; column for box
-- ftd.column:
border-width.px: 4
spacing.fixed.px: 10
width: fill-container
border-color: $box.bordercolor
color: $box.bodycolor
background.solid: $box.bg-body
;; header Row
-- ftd.row:
width: fill-container
spacing: space-between
border-bottom-width.px: 1
padding.px: 10
color: $box.headercolor
background.solid: $box.bg-header
border-color: $box.bordercolor
background.solid if { box.over }: $box.hovercolor
$on-click$: $toggle($value = $box.open)
$on-mouse-enter$: $ftd.set-bool($a = $box.over, v = true)
$on-mouse-leave$: $ftd.set-bool($a = $box.over, v = false)
-- ftd.text: $box.title
-- ftd.image:
src: $assets.files.images.downarrow.png
width.fixed.px: 20
if: { !box.open }
-- ftd.image:
src: $assets.files.images.uparrow.png
width.fixed.px: 20
if: { box.open }
-- end: ftd.row
;; header row ends
-- ftd.text: $box.body
padding.px: 10
height: hug-content
if: { box.open }
-- end: ftd.column
;; box column ends
-- end: box
-- void toggle(value):
boolean $value:
value = !value;
-- ftd.color bg-header:
light: #f1f8ff
dark: #235294
-- ftd.color bg-body:
light: #f1f8ff
dark: #235294
-- ftd.color header-text-color:
light: #858692
dark: #e2e8ec
-- ftd.color body-text-color:
light: #3f3e43
dark: #e2e8ec
-- ftd.color border-color:
light: #79ad9e
dark: #a0b2c1
-- ftd.color hover-color:
light: #b7e7d9
dark: #5276a9