@@ -70,147 +70,222 @@ export const GeneralSettings = () => {
70
70
71
71
return (
72
72
< form className = { style } onSubmit = { handleFormSubmit } >
73
- < Title size = 'xlarge' weight = 'bold' > Design Token Settings</ Title >
73
+ < Title size = "xlarge" weight = "bold" >
74
+ Design Token Settings
75
+ </ Title >
74
76
< Row >
75
77
< Checkbox
76
- label = ' Add token type to name of the token'
77
- type = ' switch'
78
+ label = " Add token type to name of the token"
79
+ type = " switch"
78
80
checked = { settings . keyInName }
79
- onChange = { value => updateSettings ( draft => { draft . keyInName = value } ) }
81
+ onChange = { ( value ) =>
82
+ updateSettings ( ( draft ) => {
83
+ draft . keyInName = value ;
84
+ } )
85
+ }
86
+ />
87
+ < Info
88
+ width = { 240 }
89
+ label = 'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".'
80
90
/>
81
- < Info width = { 240 } label = 'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".' />
82
91
</ Row >
83
- < Title size = ' small' weight = ' bold' >
92
+ < Title size = " small" weight = " bold" >
84
93
Filename
85
- < Info width = { 160 } label = 'The file name used when exporting the tokens' />
94
+ < Info
95
+ width = { 160 }
96
+ label = "The file name used when exporting the tokens"
97
+ />
86
98
</ Title >
87
- < div className = ' grid-2-col' >
99
+ < div className = " grid-2-col" >
88
100
< Input
89
- type = ' text'
101
+ type = " text"
90
102
required
91
- pattern = ' ^[\w\d\s\[\]._-]+$'
103
+ pattern = " ^[\w\d\s\[\]._\ -]+$"
92
104
placeholder = { figmaMetaData . filename }
93
105
value = { settings . filename }
94
- onChange = { value => updateSettings ( ( draft : Settings ) => { draft . filename = value } ) }
106
+ onChange = { ( value ) =>
107
+ updateSettings ( ( draft : Settings ) => {
108
+ draft . filename = value ;
109
+ } )
110
+ }
95
111
/>
96
112
< Select
97
113
defaultValue = { settings . extension }
98
- onChange = { ( { value } ) => updateSettings ( ( draft : Settings ) => { draft . extension = value as string } ) }
99
- placeholder = 'file extension'
114
+ onChange = { ( { value } ) =>
115
+ updateSettings ( ( draft : Settings ) => {
116
+ draft . extension = value as string ;
117
+ } )
118
+ }
119
+ placeholder = "file extension"
100
120
options = { config . fileExtensions }
101
121
/>
102
122
</ div >
103
123
< Separator />
104
- < div className = ' grid-2-col' >
124
+ < div className = " grid-2-col" >
105
125
< div >
106
- < Title size = 'small' weight = 'bold' > Name conversion</ Title >
126
+ < Title size = "small" weight = "bold" >
127
+ Name conversion
128
+ </ Title >
107
129
< Select
108
130
defaultValue = { settings . nameConversion }
109
- onChange = { ( { value } ) => updateSettings ( ( draft : Settings ) => { draft . nameConversion = value as nameConversionType } ) }
110
- placeholder = 'Name conversion'
131
+ onChange = { ( { value } ) =>
132
+ updateSettings ( ( draft : Settings ) => {
133
+ draft . nameConversion = value as nameConversionType ;
134
+ } )
135
+ }
136
+ placeholder = "Name conversion"
111
137
options = { [
112
138
{
113
- label : ' Default' ,
114
- value : ' default'
139
+ label : " Default" ,
140
+ value : " default" ,
115
141
} ,
116
142
{
117
- label : ' camelCase' ,
118
- value : ' camelCase'
143
+ label : " camelCase" ,
144
+ value : " camelCase" ,
119
145
} ,
120
146
{
121
- label : ' kebab-case' ,
122
- value : ' kebabCase'
123
- }
147
+ label : " kebab-case" ,
148
+ value : " kebabCase" ,
149
+ } ,
124
150
] }
125
151
/>
126
152
</ div >
127
153
< div >
128
- < Title size = 'small' weight = 'bold' > Token format< Info width = { 240 } label = 'The structure of the output json file. Learn more in the docs.' /> </ Title >
154
+ < Title size = "small" weight = "bold" >
155
+ Token format
156
+ < Info
157
+ width = { 240 }
158
+ label = "The structure of the output json file. Learn more in the docs."
159
+ />
160
+ </ Title >
129
161
< Select
130
162
defaultValue = { settings . tokenFormat }
131
163
onChange = { ( { value } ) => {
132
- updateSettings ( ( draft : Settings ) => { draft . tokenFormat = value as tokenFormatType } )
133
- setStandard ( value === 'standard' )
164
+ updateSettings ( ( draft : Settings ) => {
165
+ draft . tokenFormat = value as tokenFormatType ;
166
+ } ) ;
167
+ setStandard ( value === "standard" ) ;
134
168
} }
135
- placeholder = ' Token format'
169
+ placeholder = " Token format"
136
170
options = { [
137
171
{
138
- label : ' Standard (W3C draft)' ,
139
- value : ' standard'
172
+ label : " Standard (W3C draft)" ,
173
+ value : " standard" ,
140
174
} ,
141
175
{
142
- label : ' Original (deprecated)' ,
143
- value : ' original'
144
- }
176
+ label : " Original (deprecated)" ,
177
+ value : " original" ,
178
+ } ,
145
179
] }
146
180
/>
147
181
</ div >
148
182
</ div >
149
183
< Separator />
150
- < div className = ' grid-2-col' >
184
+ < div className = " grid-2-col" >
151
185
< div >
152
- < Title size = 'small' weight = 'bold' > Exclusion prefix < Info width = { 240 } label = 'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)' /> </ Title >
186
+ < Title size = "small" weight = "bold" >
187
+ Exclusion prefix{ " " }
188
+ < Info
189
+ width = { 240 }
190
+ label = 'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)'
191
+ />
192
+ </ Title >
153
193
< Input
154
- type = ' text'
155
- pattern = ' ^[#\+*\\/&%$!?;:~,\s]+$'
156
- placeholder = ' #, @'
194
+ type = " text"
195
+ pattern = " ^[#\+*\\/&%$!?;:~,\s]+$"
196
+ placeholder = " #, @"
157
197
value = { settings . exclusionPrefix }
158
- onChange = { value => updateSettings ( ( draft : Settings ) => { draft . exclusionPrefix = value } ) }
198
+ onChange = { ( value ) =>
199
+ updateSettings ( ( draft : Settings ) => {
200
+ draft . exclusionPrefix = value ;
201
+ } )
202
+ }
159
203
/>
160
204
</ div >
161
205
{ isStandard && (
162
206
< div >
163
- < Title size = 'small' weight = 'bold' > Alias identifier < Info width = { 180 } label = 'Use to define an alias for a token; case insensitive' /> </ Title >
207
+ < Title size = "small" weight = "bold" >
208
+ Alias identifier{ " " }
209
+ < Info
210
+ width = { 180 }
211
+ label = "Use to define an alias for a token; case insensitive"
212
+ />
213
+ </ Title >
164
214
< Input
165
- type = ' text'
166
- pattern = ' ^[A-Za-z,\s]+$'
167
- placeholder = ' alias, ref, reference'
215
+ type = " text"
216
+ pattern = " ^[A-Za-z,\s]+$"
217
+ placeholder = " alias, ref, reference"
168
218
value = { settings . alias }
169
- onChange = { value => updateSettings ( ( draft : Settings ) => { draft . alias = value } ) }
219
+ onChange = { ( value ) =>
220
+ updateSettings ( ( draft : Settings ) => {
221
+ draft . alias = value ;
222
+ } )
223
+ }
170
224
/>
171
225
</ div >
172
226
) }
173
227
</ div >
174
228
< Separator />
175
- < Title size = 'small' weight = 'bold' > Token prefixes < Info width = { 150 } label = 'Use commas to separate multiple prefixed' /> </ Title >
176
- < Text className = { textStyle } size = 'small' >
177
- Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token.
229
+ < Title size = "small" weight = "bold" >
230
+ Token prefixes{ " " }
231
+ < Info width = { 150 } label = "Use commas to separate multiple prefixed" />
232
+ </ Title >
233
+ < Text className = { textStyle } size = "small" >
234
+ Prefixes are the first part of a tokens name e.g. "radius" in
235
+ "radius/small". They are used to identify the type of a custom token.
178
236
</ Text >
179
237
< Row >
180
238
< Checkbox
181
- label = ' Include token prefix in token names'
182
- type = ' switch'
239
+ label = " Include token prefix in token names"
240
+ type = " switch"
183
241
checked = { settings . prefixInName }
184
- onChange = { ( value ) => updateSettings ( draft => { draft . prefixInName = value } ) }
242
+ onChange = { ( value ) =>
243
+ updateSettings ( ( draft ) => {
244
+ draft . prefixInName = value ;
245
+ } )
246
+ }
247
+ />
248
+ < Info
249
+ width = { 240 }
250
+ label = 'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").'
185
251
/>
186
- < Info width = { 240 } label = 'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").' />
187
252
</ Row >
188
253
< Separator />
189
- < div className = ' grid-2-col' >
190
- { Object . entries ( settings . prefix ) . map ( ( [ key , currentValue ] ) =>
254
+ < div className = " grid-2-col" >
255
+ { Object . entries ( settings . prefix ) . map ( ( [ key , currentValue ] ) => (
191
256
< Row fill key = { key } >
192
- < Label
193
- className = { `${ labelStyle } flex-grow--none` }
194
- > { key }
195
- { isStyle ( key ) ? < Info width = { 90 } label = 'Prefix for style' /> : '' }
257
+ < Label className = { `${ labelStyle } flex-grow--none` } >
258
+ { key }
259
+ { isStyle ( key ) ? < Info width = { 90 } label = "Prefix for style" /> : "" }
196
260
</ Label >
197
261
< Input
198
- type = ' text'
262
+ type = " text"
199
263
// eslint-disable-next-line
200
- pattern = { isStyle ( key ) ? ' ^[\\w\\-@]+$' : ' ^[\\w\\-@,\\s]+$' }
264
+ pattern = { isStyle ( key ) ? " ^[\\w\\-@]+$" : " ^[\\w\\-@,\\s]+$" }
201
265
required
202
266
placeholder = { key }
203
267
value = { currentValue }
204
- onChange = { value => updateSettings ( ( draft : Settings ) => { draft . prefix [ key ] = value } ) }
268
+ onChange = { ( value ) =>
269
+ updateSettings ( ( draft : Settings ) => {
270
+ draft . prefix [ key ] = value ;
271
+ } )
272
+ }
205
273
/>
206
274
</ Row >
207
- ) }
275
+ ) ) }
208
276
</ div >
209
277
< Footer >
210
- < WebLink align = 'start' href = 'https://github.com/lukasoppermann/design-tokens#design-tokens' > Documentation</ WebLink >
278
+ < WebLink
279
+ align = "start"
280
+ href = "https://github.com/lukasoppermann/design-tokens#design-tokens"
281
+ >
282
+ Documentation
283
+ </ WebLink >
211
284
< CancelButton />
212
- < Button type = 'submit' autofocus > Save changes</ Button >
285
+ < Button type = "submit" autofocus >
286
+ Save changes
287
+ </ Button >
213
288
</ Footer >
214
289
</ form >
215
- )
290
+ ) ;
216
291
}
0 commit comments