Skip to content

Commit 61788a3

Browse files
committed
Add tree variant for dual list select demo
1 parent 5c2ec9f commit 61788a3

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

packages/react-renderer-demo/src/pages/provided-mappers/dual-list-select.js

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,79 @@ const schema = {
3434
]
3535
};
3636

37+
const treeSchmea = {
38+
fields: [
39+
{
40+
component: componentTypes.DUAL_LIST_SELECT,
41+
name: 'dual-list-select',
42+
isTree: true,
43+
options: [
44+
{
45+
label: 'Animals',
46+
hasBadge: true,
47+
badgeProps: {
48+
isRead: true
49+
},
50+
children: [
51+
{
52+
value: 'lions',
53+
label: 'Lions'
54+
},
55+
{
56+
value: 'dogs',
57+
label: 'Dogs'
58+
},
59+
{
60+
label: 'Birds',
61+
children: [
62+
{
63+
label: 'Pigeons',
64+
value: 'pigens'
65+
}
66+
]
67+
}
68+
]
69+
},
70+
{
71+
label: 'Cars',
72+
children: [
73+
{
74+
value: 'suv',
75+
label: 'SUVs'
76+
},
77+
{
78+
value: 'hatchbacks',
79+
label: 'Hatchbacks'
80+
},
81+
{
82+
value: 'sedans',
83+
label: 'Sedans'
84+
},
85+
{
86+
label: 'Military',
87+
children: [
88+
{
89+
label: 'Jeeps',
90+
value: 'jeep'
91+
}
92+
]
93+
}
94+
]
95+
}
96+
]
97+
}
98+
]
99+
};
100+
37101
const variants = [...baseFieldProps];
38102

39-
const DualListSelect = () => <ComponentText schema={schema} variants={variants} linkText="Dual list select" />;
103+
const basicVariant = { schema, label: 'Basic', value: 'basic' };
104+
const treeVariant = { schema: treeSchmea, label: 'Tree', value: 'tree' };
105+
106+
const schemaVariants = {
107+
pf4: [basicVariant, treeVariant]
108+
};
109+
110+
const DualListSelect = () => <ComponentText schema={schema} variants={variants} linkText="Dual list select" schemaVariants={schemaVariants} />;
40111

41112
export default DualListSelect;

0 commit comments

Comments
 (0)