diff --git a/packages/react-components/react-color-picker-preview/stories/src/ColorPicker/AlphaSliderDefault.stories.tsx b/packages/react-components/react-color-picker-preview/stories/src/ColorPicker/AlphaSliderDefault.stories.tsx index f837f1dcc65f4..82867dbc8a908 100644 --- a/packages/react-components/react-color-picker-preview/stories/src/ColorPicker/AlphaSliderDefault.stories.tsx +++ b/packages/react-components/react-color-picker-preview/stories/src/ColorPicker/AlphaSliderDefault.stories.tsx @@ -27,13 +27,14 @@ export const AlphaSliderExample = (props: Partial) => { const styles = useStyles(); const [color, setColor] = React.useState(COLOR); -const [transparancyColor, setTransparancyColor] = React.useState(COLOR); -const [value, setValue] = React.useState(COLOR.a * 100); -const onSliderChange: AlphaSliderProps['onChange'] = (_, data) => { + const [transparancyColor, setTransparancyColor] = React.useState(COLOR); + const [value, setValue] = React.useState(COLOR.a * 100); + const onSliderChange: AlphaSliderProps['onChange'] = (_, data) => { const alpha = data.color.a ?? 1; setColor({ ...data.color, a: alpha }); setValue(alpha * 100); - }; const onTransparancySliderChange: AlphaSliderProps['onChange'] = (_, data) => + }; + const onTransparancySliderChange: AlphaSliderProps['onChange'] = (_, data) => setTransparancyColor({ ...data.color, a: data.color.a ?? 1 }); const resetSlider = () => setColor(COLOR); const resetTransparencySlider = () => setTransparancyColor(COLOR); @@ -52,9 +53,23 @@ const onSliderChange: AlphaSliderProps['onChange'] = (_, data) => {

Transparency

- - + +