generated from fastn-stack/fastn-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-to-ftd.ftd
175 lines (143 loc) · 3.81 KB
/
json-to-ftd.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
-- string $result: None
-- string $formatted-string: None
-- string $current-json: None
-- void json-to-ftd(json,store_at,formatted_string):
string json:
string $store_at:
string $formatted_string:
value = figma_json_to_ftd(json);
store_at = value[0];
formatted_string = value[1];
-- component json-exporter:
-- ftd.column:
background.solid: black
width: fill-container
height: fill-container
spacing.fixed.px: 20
padding.px: 20
-- ftd.row:
spacing.fixed.px: 15
align-content: center
-- ftd.text-input:
placeholder: Enter figma json data
multiline: true
padding-right.px: 10
width.fixed.px: 500
height.fixed.px: 200
$on-input$: $ftd.set-string($a = $current-json, v = $VALUE)
-- ftd.text: Change to FTD
role: $inherited.types.heading-small
color: $inherited.colors.text-strong
width.fixed.px: 200
$on-click$: $json-to-ftd(json = $current-json, $store_at = $result, $formatted_string = $formatted-string, escaped = false)
-- end: ftd.row
-- code: FTD code
if: { result != "None" }
lang: ftd
body: $formatted-string
text: $result
-- end: ftd.column
-- end: json-exporter
-- json-exporter:
-- ftd.color code-bg-light:
light: #2b303b
dark: #18181b
-- ftd.color code-bg-dark:
light: #18181b
dark: #2b303b
-- component code:
optional caption caption:
body body:
optional string text:
string lang:
boolean clip: true
string $copy-text: null
-- ftd.column:
padding-bottom.px: 12
padding-top.px: 12
width.fixed.px: 500
height.fixed.px: 500
-- ftd.row:
width: fill-container
background.solid: $inherited.colors.background.step-1
padding-top.px: 10
padding-bottom.px: 10
padding-left.px: 20
padding-right.px: 20
border-top-left-radius.px: 4
border-top-right-radius.px: 4
;;align-content: center
-- ftd.text: $code.caption
if: { $code.caption != NULL }
role: $inherited.types.copy-regular
color: $inherited.colors.text
width: fill-container
-- ftd.row:
if: { code.clip }
spacing.fixed.px: 10
align-content: right
width: fill-container
$on-click-outside$: $ftd.set-string($a = $code.copy-text, v = null)
-- ftd.text: Copy
if: { code.copy-text == "null" }
role: $inherited.types.copy-regular
color: $inherited.colors.border
$on-click$: $ftd.copy-to-clipboard(a = $code.text)
$on-click$: $ftd.set-string($a = $code.copy-text, v = Copied!)
/-- ftd.image:
if: { code.copy-text == "null" }
src: $assets.files.static.copy.svg
$on-click$: $ftd.copy-to-clipboard(a = $code.body)
$on-click$: $ftd.set-string($a = $code.copy-text, v = Copied!)
width.fixed.px: 18
/-- ftd.image:
if: {code.copy-text != "null"}
src: $assets.files.static.tick.svg
width.fixed.px: 18
-- ftd.text: $code.copy-text
if: { code.copy-text != "null" }
role: $inherited.types.copy-regular
color: $inherited.colors.text-strong
-- end: ftd.row
-- end: ftd.row
-- ftd.code:
if: { ftd.dark-mode }
text: $code.body
lang: $code.lang
width: fill-container
role: $inherited.types.copy-regular
color: $inherited.colors.text
padding-top.px: 10
padding-left.px: 20
padding-bottom.px: 10
padding-right.px: 20
background.solid: $code-bg-dark
border-top-left-radius.px if {$code.caption == NULL}: 4
border-top-right-radius.px if {$code.caption == NULL}: 4
border-bottom-left-radius.px: 4
border-bottom-right-radius.px: 4
;; border-width.px: 1
;; border-color: $code-bg-dark
overflow-x: auto
-- ftd.code:
if: { !ftd.dark-mode}
text: $code.body
lang: $code.lang
width: fill-container
role: $inherited.types.copy-regular
color: $inherited.colors.text
padding-top.px: 10
padding-left.px: 20
padding-bottom.px: 10
padding-right.px: 20
background.solid: #eff1f5
border-top-left-radius.px if {$code.caption == NULL}: 4
border-top-right-radius.px if {$code.caption == NULL}: 4
border-bottom-left-radius.px if {$code.caption == NULL}: 4
border-bottom-right-radius.px if {$code.caption == NULL}: 4
border-color: $inherited.colors.background.step-1
border-width.px: 0
overflow-x: auto
theme: base16-ocean.light
-- end: ftd.column
-- end: code