Skip to content

Commit bd81937

Browse files
committed
Add shared variants form demo examples
1 parent 2c34334 commit bd81937

File tree

1 file changed

+85
-63
lines changed

1 file changed

+85
-63
lines changed

packages/react-renderer-demo/src/app/src/components/navigation/examples-definitions.js

Lines changed: 85 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ import TabsText from './examples-texts/tabs';
44
import CustomComponentText from './examples-texts/custom-component';
55
import WizardText from './examples-texts/wizard';
66
import SelectText from './examples-texts/select';
7+
import DualListSelect from './examples-texts/dual-list-select';
8+
9+
const formGroupVariants = [
10+
{
11+
name: 'isDisabled',
12+
title: 'Disabled'
13+
},
14+
{
15+
name: 'helperText',
16+
title: 'Helper text',
17+
component: 'input'
18+
},
19+
{
20+
name: 'description',
21+
title: 'Description',
22+
component: 'input'
23+
},
24+
{
25+
name: 'isReadOnly',
26+
title: 'Read only'
27+
}
28+
];
729

830
export const baseExamples = [
931
{
@@ -22,15 +44,7 @@ export const baseExamples = [
2244
},
2345
canBeRequired: true,
2446
variants: [
25-
{
26-
name: 'isDisabled',
27-
title: 'Disabled'
28-
},
29-
{
30-
name: 'helperText',
31-
title: 'Helper text',
32-
component: 'input'
33-
},
47+
...formGroupVariants,
3448
{
3549
name: 'label',
3650
title: 'Label',
@@ -46,38 +60,26 @@ export const baseExamples = [
4660
name: 'placeholder',
4761
title: 'Placeholder',
4862
component: 'input'
49-
},
50-
{
51-
name: 'isReadOnly',
52-
title: 'Read only'
5363
}
5464
]
5565
},
5666
{
57-
component: componentTypes.TEXTAREA,
58-
link: componentTypes.TEXTAREA,
67+
component: componentTypes.TEXTAREA_FIELD,
68+
link: componentTypes.TEXTAREA_FIELD,
5969
linkText: 'Text area',
6070
ContentText: GenericComponentText,
6171
canBeRequired: true,
6272
value: {
6373
fields: [
6474
{
65-
component: componentTypes.TEXTAREA,
75+
component: componentTypes.TEXTAREA_FIELD,
6676
label: 'Long text',
6777
name: 'long-text'
6878
}
6979
]
7080
},
7181
variants: [
72-
{
73-
name: 'isDisabled',
74-
title: 'Disabled'
75-
},
76-
{
77-
name: 'helperText',
78-
title: 'Helper text',
79-
component: 'input'
80-
},
82+
...formGroupVariants,
8183
{
8284
name: 'label',
8385
title: 'Label',
@@ -88,10 +90,6 @@ export const baseExamples = [
8890
name: 'placeholder',
8991
title: 'Placeholder',
9092
component: 'input'
91-
},
92-
{
93-
name: 'isReadOnly',
94-
title: 'Read only'
9593
}
9694
]
9795
},
@@ -114,10 +112,7 @@ export const baseExamples = [
114112
]
115113
},
116114
variants: [
117-
{
118-
name: 'isDisabled',
119-
title: 'Disabled'
120-
},
115+
...formGroupVariants,
121116
{
122117
name: 'label',
123118
title: 'Label',
@@ -147,10 +142,7 @@ export const baseExamples = [
147142
]
148143
},
149144
variants: [
150-
{
151-
name: 'isDisabled',
152-
title: 'Disabled'
153-
},
145+
...formGroupVariants,
154146
{
155147
name: 'label',
156148
title: 'Label',
@@ -160,15 +152,15 @@ export const baseExamples = [
160152
]
161153
},
162154
{
163-
component: componentTypes.SELECT,
164-
link: componentTypes.SELECT,
155+
component: componentTypes.SELECT_COMPONENT,
156+
link: componentTypes.SELECT_COMPONENT,
165157
linkText: 'Select',
166158
ContentText: SelectText,
167159
canBeRequired: true,
168160
value: {
169161
fields: [
170162
{
171-
component: componentTypes.SELECT,
163+
component: componentTypes.SELECT_COMPONENT,
172164
label: 'Select',
173165
name: 'select',
174166
simpleValue: true,
@@ -181,10 +173,7 @@ export const baseExamples = [
181173
]
182174
},
183175
variants: [
184-
{
185-
name: 'isDisabled',
186-
title: 'Disabled'
187-
},
176+
...formGroupVariants,
188177
{
189178
name: 'label',
190179
title: 'Label',
@@ -234,14 +223,7 @@ export const baseExamples = [
234223
]
235224
},
236225
variants: [
237-
{
238-
name: 'isReadOnly',
239-
title: 'Read only'
240-
},
241-
{
242-
name: 'isDisabled',
243-
title: 'Disabled'
244-
},
226+
...formGroupVariants,
245227
{
246228
name: 'label',
247229
title: 'Label',
@@ -276,6 +258,7 @@ export const baseExamples = [
276258
]
277259
},
278260
variants: [
261+
...formGroupVariants,
279262
{
280263
name: 'label',
281264
title: 'Label',
@@ -323,6 +306,7 @@ export const baseExamples = [
323306
]
324307
},
325308
variants: [
309+
...formGroupVariants,
326310
{
327311
name: 'label',
328312
title: 'Label',
@@ -440,10 +424,7 @@ export const baseExamples = [
440424
]
441425
},
442426
variants: [
443-
{
444-
name: 'isDisabled',
445-
title: 'Disabled'
446-
},
427+
...formGroupVariants,
447428
{
448429
name: 'label',
449430
title: 'Label',
@@ -477,6 +458,43 @@ Vestibulum vulputate inceptos himenaeos.`
477458
]
478459
}
479460
},
461+
{
462+
component: 'dual-list-select',
463+
link: 'dual-list-select',
464+
linkText: 'Dual list select',
465+
ContentText: DualListSelect,
466+
variants: [...formGroupVariants],
467+
value: {
468+
fields: [
469+
{
470+
component: 'dual-list-select',
471+
name: 'dual-list-select',
472+
options: [
473+
{
474+
value: 'cats',
475+
label: 'cats'
476+
},
477+
{
478+
value: 'cats_1',
479+
label: 'cats_1'
480+
},
481+
{
482+
value: 'cats_2',
483+
label: 'cats_2'
484+
},
485+
{
486+
value: 'zebras',
487+
label: 'zebras'
488+
},
489+
{
490+
value: 'pigeons',
491+
label: 'pigeons'
492+
}
493+
]
494+
}
495+
]
496+
}
497+
},
480498
{
481499
component: componentTypes.WIZARD,
482500
link: componentTypes.WIZARD,
@@ -490,7 +508,8 @@ Vestibulum vulputate inceptos himenaeos.`
490508
fields: [
491509
{
492510
title: 'Get started with adding source',
493-
name: 1,
511+
name: 'step-1',
512+
stepKey: 1,
494513
nextStep: {
495514
when: 'source-type',
496515
stepMapper: {
@@ -500,13 +519,13 @@ Vestibulum vulputate inceptos himenaeos.`
500519
},
501520
fields: [
502521
{
503-
component: componentTypes.TEXTAREA,
522+
component: componentTypes.TEXTAREA_FIELD,
504523
name: 'source-name',
505524
type: 'text',
506525
label: 'Source name'
507526
},
508527
{
509-
component: componentTypes.SELECT,
528+
component: componentTypes.SELECT_COMPONENT,
510529
name: 'source-type',
511530
label: 'Source type',
512531
isRequired: true,
@@ -533,7 +552,8 @@ Vestibulum vulputate inceptos himenaeos.`
533552
},
534553
{
535554
title: 'Configure AWS',
536-
name: 'aws',
555+
name: 'step-2',
556+
stepKey: 'aws',
537557
nextStep: 'summary',
538558
fields: [
539559
{
@@ -544,8 +564,9 @@ Vestibulum vulputate inceptos himenaeos.`
544564
]
545565
},
546566
{
547-
name: 'google',
567+
stepKey: 'google',
548568
title: 'Configure google',
569+
name: 'step-3',
549570
nextStep: 'summary',
550571
fields: [
551572
{
@@ -562,6 +583,7 @@ Vestibulum vulputate inceptos himenaeos.`
562583
component: 'summary'
563584
}
564585
],
586+
stepKey: 'summary',
565587
name: 'summary'
566588
}
567589
]
@@ -570,8 +592,8 @@ Vestibulum vulputate inceptos himenaeos.`
570592
},
571593
variants: [],
572594
next: {
573-
link: '/others/miq-components',
574-
label: 'ManageIQ components'
595+
link: '/releases',
596+
label: 'Releases'
575597
},
576598
prev: {
577599
link: '/component-example/time-picker',

0 commit comments

Comments
 (0)