Skip to content

Commit

Permalink
fix after resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinaKozlova committed Jan 8, 2025
1 parent 9fa9b5e commit 242f408
Showing 1 changed file with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ export const AlphaSliderExample = (props: Partial<AlphaSliderProps>) => {
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);
Expand All @@ -52,9 +53,23 @@ const onSliderChange: AlphaSliderProps['onChange'] = (_, data) => {
<div className={styles.previewColor} style={{ backgroundColor: tinycolor(color).toRgbString() }} />
<Button onClick={resetSlider}>Reset</Button>
<h3>Transparency</h3>
<AlphaSlider color={transparancyColor} onChange={onTransparancySliderChange} transparency {...props} />
<AlphaSlider color={transparancyColor} onChange={onTransparancySliderChange} aria-valuetext={`${value}%`}
aria-label="Vertical alpha" transparency vertical {...props} />
<AlphaSlider
color={transparancyColor}
onChange={onTransparancySliderChange}
aria-valuetext={`${value}%`}
aria-label="Alpha"
transparency
{...props}
/>
<AlphaSlider
color={transparancyColor}
onChange={onTransparancySliderChange}
aria-valuetext={`${value}%`}
aria-label="Vertical alpha"
transparency
vertical
{...props}
/>
<div className={styles.previewColor} style={{ backgroundColor: tinycolor(transparancyColor).toRgbString() }} />
<Button onClick={resetTransparencySlider}>Reset</Button>
</div>
Expand Down

0 comments on commit 242f408

Please sign in to comment.