Skip to content

Commit c1aea99

Browse files
durvesh1992cixzhang
authored andcommitted
docs(cli): make Slider/Selector/MultiSelector showcases interactive
Closes #3187. Closes #3188. Closes #3189. These showcase blocks rendered controlled components with a static value and a no-op/missing onChange, so the docsite previews appeared frozen (dragging the slider / picking an option did nothing). Wire local useState + onChange in each, mirroring the other examples (SliderWithMarks, SelectorWithSections, MultiSelectorColumnVisibilitySelector). MultiSelectorShowcase also gains 'use client' now that it uses state.
1 parent bdc7bd7 commit c1aea99

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@astryxdesign/cli': patch
3+
---
4+
5+
[docs] Wire local state into the Slider, Selector, and MultiSelector showcase examples so they are interactive — they were controlled components with a static value and a no-op/missing onChange, so the docsite previews appeared frozen (#3187, #3188, #3189)
6+
@durvesh1992

packages/cli/templates/blocks/components/MultiSelector/MultiSelectorShowcase.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
// Copyright (c) Meta Platforms, Inc. and affiliates.
22

3+
'use client';
4+
5+
import {useState} from 'react';
36
import {MultiSelector} from '@astryxdesign/core/MultiSelector';
47

58
export default function MultiSelectorShowcase() {
9+
const [value, setValue] = useState<string[]>([]);
610
return (
711
<div style={{width: 300}}>
812
<MultiSelector
913
label="Columns"
1014
options={['Name', 'Email', 'Role', 'Status', 'Created']}
11-
value={[]}
12-
onChange={() => {}}
15+
value={value}
16+
onChange={setValue}
1317
placeholder="Select columns..."
1418
/>
1519
</div>

packages/cli/templates/blocks/components/Selector/SelectorShowcase.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
'use client';
44

5+
import {useState} from 'react';
56
import {Selector} from '@astryxdesign/core/Selector';
67

78
export default function SelectorShowcase() {
9+
const [value, setValue] = useState<string | undefined>();
810
return (
911
<Selector
1012
style={{width: 300}}
1113
label="Fruit"
1214
options={['Apple', 'Banana', 'Orange', 'Mango', 'Pineapple']}
1315
placeholder="Select a fruit..."
14-
onChange={() => {}}
16+
value={value}
17+
onChange={setValue}
1518
/>
1619
);
1720
}

0 commit comments

Comments
 (0)