-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(segmentedcontrol): add disabled state in button definition and c…
…ontrolled/uncontrolled state (#869)
- Loading branch information
1 parent
d7be2ca
commit d59af72
Showing
6 changed files
with
440 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...components/src/core/SegmentedControl/__storybook__/stories/controlledSegmentedControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Args } from "@storybook/react"; | ||
import { useState } from "react"; | ||
import RawSegmentedControl from "src/core/SegmentedControl"; | ||
|
||
export const ControlledSegmentedControlDemo = (props: Args): JSX.Element => { | ||
const { buttonDefinition, ...rest } = props; | ||
|
||
const [value, setValue] = useState("C"); | ||
return ( | ||
<RawSegmentedControl | ||
buttonDefinition={buttonDefinition} | ||
onChange={(_event, newValue) => { | ||
console.log(newValue); | ||
setValue(newValue); | ||
}} | ||
value={value} | ||
{...rest} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.