-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8975b05
commit df41a58
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
packages/react-components/react-slider/stories/src/Slider/SliderCustomized.stories.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,47 @@ | ||
import * as React from 'react'; | ||
import { useId, Label, Slider, makeStyles, sliderCSSVars, tokens } from '@fluentui/react-components'; | ||
|
||
const { sliderProgressColorVar, sliderRailColorVar, sliderThumbColorVar, sliderThumbSizeVar } = sliderCSSVars; | ||
|
||
const useStyles = makeStyles({ | ||
enabled: { | ||
[sliderProgressColorVar]: '#ff0764', | ||
[sliderRailColorVar]: tokens.colorNeutralForeground1, | ||
[sliderThumbColorVar]: '#ff0764', | ||
':hover': { | ||
[sliderThumbColorVar]: '#d60d58', | ||
[sliderProgressColorVar]: '#d60d58', | ||
':active': { | ||
[sliderThumbColorVar]: '#b91150', | ||
[sliderProgressColorVar]: '#b91150', | ||
}, | ||
}, | ||
}, | ||
thumb: { | ||
[sliderThumbSizeVar]: '16px', | ||
boxShadow: `0 0 0 calc(var(${sliderThumbSizeVar}) * .2) ${tokens.colorTransparentBackground} inset`, | ||
'::before': { | ||
content: 'unset', | ||
}, | ||
}, | ||
}); | ||
|
||
export const Customized = () => { | ||
const id = useId(); | ||
const styles = useStyles(); | ||
|
||
return ( | ||
<> | ||
<Label htmlFor={id}>Customized slider</Label> | ||
<Slider className={styles.enabled} thumb={{ className: styles.thumb }} defaultValue={20} size="small" id={id} /> | ||
</> | ||
); | ||
}; | ||
|
||
Customized.parameters = { | ||
docs: { | ||
description: { | ||
story: 'Customized slider using its variables', | ||
}, | ||
}, | ||
}; |
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