@@ -7,15 +7,14 @@ import {
7
7
} from '@nivo/core'
8
8
import { ResponsiveBar } from '@nivo/bar'
9
9
import { ResponsiveLine } from '@nivo/line'
10
- // @ts -ignore
11
10
import Layout from '../../components/Layout'
12
11
import { Seo } from '../../components/Seo'
13
12
import { ComponentPage } from '../../components/components/ComponentPage'
14
13
import { ComponentHeader } from '../../components/components/ComponentHeader'
15
14
import { Markdown } from '../../components/Markdown'
16
15
import { ComponentSettings } from '../../components/components/ComponentSettings'
17
16
import media from '../../theming/mediaQueries'
18
- import { ChartProperty } from '../../types'
17
+ import { ChartPropertiesGroup } from '../../types'
19
18
20
19
const initialTheme : Theme = {
21
20
background : '#ffffff' , // defaultTheme.background,
@@ -41,30 +40,61 @@ const initialTheme: Theme = {
41
40
strokeWidth : defaultTheme . grid . line . strokeWidth ,
42
41
} ,
43
42
} ,
43
+ annotations : {
44
+ text : {
45
+ fontSize : defaultTheme . annotations . text . fontSize ,
46
+ outlineWidth : defaultTheme . annotations . text . outlineWidth ,
47
+ outlineColor : defaultTheme . annotations . text . outlineColor ,
48
+ outlineOpacity : defaultTheme . annotations . text . outlineOpacity ,
49
+ } ,
50
+ link : {
51
+ stroke : defaultTheme . annotations . link . stroke ,
52
+ strokeWidth : defaultTheme . annotations . link . strokeWidth ,
53
+ outlineWidth : defaultTheme . annotations . link . outlineWidth ,
54
+ outlineColor : defaultTheme . annotations . link . outlineColor ,
55
+ outlineOpacity : defaultTheme . annotations . link . outlineOpacity ,
56
+ } ,
57
+ outline : {
58
+ stroke : defaultTheme . annotations . outline . stroke ,
59
+ strokeWidth : defaultTheme . annotations . outline . strokeWidth ,
60
+ outlineWidth : defaultTheme . annotations . outline . outlineWidth ,
61
+ outlineColor : defaultTheme . annotations . outline . outlineColor ,
62
+ outlineOpacity : defaultTheme . annotations . outline . outlineOpacity ,
63
+ } ,
64
+ symbol : {
65
+ fill : defaultTheme . annotations . symbol . fill ,
66
+ outlineWidth : defaultTheme . annotations . symbol . outlineWidth ,
67
+ outlineColor : defaultTheme . annotations . symbol . outlineColor ,
68
+ outlineOpacity : defaultTheme . annotations . symbol . outlineOpacity ,
69
+ } ,
70
+ } ,
44
71
}
45
72
46
- const controlGroups : {
47
- name : string
48
- group : string
49
- properties : ChartProperty [ ]
50
- } [ ] = [
73
+ const controlGroups : ChartPropertiesGroup [ ] = [
51
74
{
52
- name : 'Theme' ,
53
- group : 'Theme' ,
75
+ name : 'Base' ,
54
76
properties : [
55
77
{
78
+ group : 'Theme' ,
79
+ key : 'background' ,
56
80
name : 'background' ,
81
+ type : 'string' ,
57
82
help : 'main background color.' ,
58
83
control : { type : 'colorPicker' } ,
59
84
} ,
60
85
{
86
+ group : 'Theme' ,
87
+ key : 'textColor' ,
61
88
name : 'textColor' ,
89
+ type : 'string' ,
62
90
help : 'main text color.' ,
63
91
control : { type : 'colorPicker' } ,
64
92
} ,
65
- // fontFamily: 'sans-serif',
66
93
{
94
+ group : 'Theme' ,
95
+ key : 'fontSize' ,
67
96
name : 'fontSize' ,
97
+ type : 'number' ,
68
98
help : 'main font size.' ,
69
99
control : {
70
100
type : 'range' ,
@@ -73,30 +103,40 @@ const controlGroups: {
73
103
max : 36 ,
74
104
} ,
75
105
} ,
106
+ ] ,
107
+ } ,
108
+ {
109
+ name : 'Axes & Grid' ,
110
+ properties : [
76
111
{
112
+ group : 'Theme' ,
113
+ key : 'axis' ,
77
114
name : 'axis' ,
115
+ type : 'object' ,
78
116
control : {
79
117
type : 'object' ,
80
118
isOpenedByDefault : true ,
81
119
props : [
82
120
{
83
121
key : 'ticks' ,
122
+ type : 'object' ,
84
123
control : {
85
124
type : 'object' ,
86
- isOpenedByDefault : true ,
87
125
props : [
88
126
{
89
127
key : 'line' ,
128
+ type : 'object' ,
90
129
control : {
91
130
type : 'object' ,
92
- isOpenedByDefault : true ,
93
131
props : [
94
132
{
95
133
key : 'strokeWidth' ,
134
+ type : 'number' ,
96
135
control : { type : 'lineWidth' } ,
97
136
} ,
98
137
{
99
138
key : 'stroke' ,
139
+ type : 'string' ,
100
140
control : { type : 'colorPicker' } ,
101
141
} ,
102
142
] ,
@@ -107,22 +147,24 @@ const controlGroups: {
107
147
} ,
108
148
{
109
149
key : 'domain' ,
150
+ type : 'object' ,
110
151
control : {
111
152
type : 'object' ,
112
- isOpenedByDefault : true ,
113
153
props : [
114
154
{
115
155
key : 'line' ,
156
+ type : 'object' ,
116
157
control : {
117
158
type : 'object' ,
118
- isOpenedByDefault : true ,
119
159
props : [
120
160
{
121
161
key : 'strokeWidth' ,
162
+ type : 'number' ,
122
163
control : { type : 'lineWidth' } ,
123
164
} ,
124
165
{
125
166
key : 'stroke' ,
167
+ type : 'string' ,
126
168
control : { type : 'colorPicker' } ,
127
169
} ,
128
170
] ,
@@ -135,25 +177,178 @@ const controlGroups: {
135
177
} ,
136
178
} ,
137
179
{
180
+ group : 'Theme' ,
181
+ key : 'grid' ,
138
182
name : 'grid' ,
183
+ type : 'object' ,
139
184
control : {
140
185
type : 'object' ,
141
186
isOpenedByDefault : true ,
142
187
props : [
143
188
{
144
189
key : 'line' ,
190
+ type : 'object' ,
191
+ control : {
192
+ type : 'object' ,
193
+ props : [
194
+ {
195
+ key : 'stroke' ,
196
+ type : 'string' ,
197
+ control : { type : 'colorPicker' } ,
198
+ } ,
199
+ {
200
+ key : 'strokeWidth' ,
201
+ type : 'number' ,
202
+ control : { type : 'lineWidth' } ,
203
+ } ,
204
+ ] ,
205
+ } ,
206
+ } ,
207
+ ] ,
208
+ } ,
209
+ } ,
210
+ ] ,
211
+ } ,
212
+ {
213
+ name : 'Annotations' ,
214
+ properties : [
215
+ {
216
+ group : 'Theme' ,
217
+ key : 'annotations' ,
218
+ name : 'annotations' ,
219
+ type : 'object' ,
220
+ control : {
221
+ type : 'object' ,
222
+ isOpenedByDefault : true ,
223
+ props : [
224
+ {
225
+ key : 'text' ,
226
+ type : 'object' ,
227
+ control : {
228
+ type : 'object' ,
229
+ props : [
230
+ {
231
+ key : 'fontSize' ,
232
+ type : 'number' ,
233
+ control : {
234
+ type : 'range' ,
235
+ unit : 'px' ,
236
+ min : 6 ,
237
+ max : 36 ,
238
+ } ,
239
+ } ,
240
+ {
241
+ key : 'outlineWidth' ,
242
+ type : 'number' ,
243
+ control : { type : 'lineWidth' } ,
244
+ } ,
245
+ {
246
+ key : 'outlineColor' ,
247
+ type : 'string' ,
248
+ control : { type : 'colorPicker' } ,
249
+ } ,
250
+ {
251
+ key : 'outlineOpacity' ,
252
+ type : 'number' ,
253
+ control : { type : 'opacity' } ,
254
+ } ,
255
+ ] ,
256
+ } ,
257
+ } ,
258
+ {
259
+ key : 'link' ,
260
+ type : 'object' ,
261
+ control : {
262
+ type : 'object' ,
263
+ props : [
264
+ {
265
+ key : 'stroke' ,
266
+ type : 'string' ,
267
+ control : { type : 'colorPicker' } ,
268
+ } ,
269
+ {
270
+ key : 'strokeWidth' ,
271
+ type : 'number' ,
272
+ control : { type : 'lineWidth' } ,
273
+ } ,
274
+ {
275
+ key : 'outlineWidth' ,
276
+ type : 'number' ,
277
+ control : { type : 'lineWidth' } ,
278
+ } ,
279
+ {
280
+ key : 'outlineColor' ,
281
+ type : 'string' ,
282
+ control : { type : 'colorPicker' } ,
283
+ } ,
284
+ {
285
+ key : 'outlineOpacity' ,
286
+ type : 'number' ,
287
+ control : { type : 'opacity' } ,
288
+ } ,
289
+ ] ,
290
+ } ,
291
+ } ,
292
+ {
293
+ key : 'outline' ,
294
+ type : 'object' ,
145
295
control : {
146
296
type : 'object' ,
147
- isOpenedByDefault : true ,
148
297
props : [
149
298
{
150
299
key : 'stroke' ,
300
+ type : 'string' ,
151
301
control : { type : 'colorPicker' } ,
152
302
} ,
153
303
{
154
304
key : 'strokeWidth' ,
305
+ type : 'number' ,
155
306
control : { type : 'lineWidth' } ,
156
307
} ,
308
+ {
309
+ key : 'outlineWidth' ,
310
+ type : 'number' ,
311
+ control : { type : 'lineWidth' } ,
312
+ } ,
313
+ {
314
+ key : 'outlineColor' ,
315
+ type : 'string' ,
316
+ control : { type : 'colorPicker' } ,
317
+ } ,
318
+ {
319
+ key : 'outlineOpacity' ,
320
+ type : 'number' ,
321
+ control : { type : 'opacity' } ,
322
+ } ,
323
+ ] ,
324
+ } ,
325
+ } ,
326
+ {
327
+ key : 'symbol' ,
328
+ type : 'object' ,
329
+ control : {
330
+ type : 'object' ,
331
+ props : [
332
+ {
333
+ key : 'fill' ,
334
+ type : 'string' ,
335
+ control : { type : 'colorPicker' } ,
336
+ } ,
337
+ {
338
+ key : 'outlineWidth' ,
339
+ type : 'number' ,
340
+ control : { type : 'lineWidth' } ,
341
+ } ,
342
+ {
343
+ key : 'outlineColor' ,
344
+ type : 'string' ,
345
+ control : { type : 'colorPicker' } ,
346
+ } ,
347
+ {
348
+ key : 'outlineOpacity' ,
349
+ type : 'number' ,
350
+ control : { type : 'opacity' } ,
351
+ } ,
157
352
] ,
158
353
} ,
159
354
} ,
@@ -221,6 +416,7 @@ const Theming = () => {
221
416
{ id : 'E' , value : 23 } ,
222
417
] }
223
418
theme = { theme }
419
+ colorBy = "indexValue"
224
420
animate = { false }
225
421
axisBottom = { {
226
422
legend : 'X axis legend' ,
@@ -347,7 +543,9 @@ const Nav = styled.nav`
347
543
` }
348
544
`
349
545
350
- const NavItem = styled . span `
546
+ const NavItem = styled . span < {
547
+ isCurrent : boolean
548
+ } > `
351
549
cursor: pointer;
352
550
height: 46px;
353
551
display: flex;
@@ -413,4 +611,5 @@ const Code = styled.pre`
413
611
font-size: 0.8rem;
414
612
line-height: 1.7;
415
613
padding: 12px 20px;
614
+ overflow-y: auto;
416
615
`
0 commit comments