-
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.
Merge pull request #811 from lyytioy/next
Version 4.1.0
- Loading branch information
Showing
5 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,10 @@ | ||
import { Slider as MuiSlider } from "@mui/material"; | ||
import { SliderProps as MuiSliderProps } from '@mui/material/Slider/Slider' | ||
|
||
export interface SliderProps extends MuiSliderProps {} | ||
|
||
const Slider = ({ ...props }: SliderProps) => { | ||
return <MuiSlider {...props} /> | ||
} | ||
|
||
export default Slider; |
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
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,78 @@ | ||
import { StoryFn, Meta } from '@storybook/react'; | ||
import { Box } from '../../src'; | ||
import Slider, { SliderProps } from '../../src/components/Slider' | ||
|
||
const meta: Meta<typeof Slider> = { | ||
title: 'Components/Inputs/Slider', | ||
component: Slider, | ||
argTypes: { | ||
min: { | ||
control: { type: 'number'}, | ||
table: { defaultValue: { summary: 0 } }, | ||
description: 'Minimal value that can be set', | ||
}, | ||
max: { | ||
control: { type: 'number'}, | ||
table: { defaultValue: { summary: 100 } }, | ||
description: 'Maximum value that can be set', | ||
}, | ||
step: { | ||
control: { type: 'number'}, | ||
table: { defaultValue: { summary: 1 } }, | ||
description: 'Each step value the slider will take', | ||
}, | ||
valueLabelDisplay: { | ||
control: { options: ['on', 'auto', 'off'] }, | ||
table: { defaultValue: { summary: 'off' } }, | ||
description: 'Controls labels visibility', | ||
}, | ||
marks: { | ||
control: { type: 'object'}, | ||
table: { defaultValue: { summary: false } }, | ||
description: 'Marks to display on the slider. {value: number, label: string}[] or boolean', | ||
}, | ||
}, | ||
}; | ||
|
||
const Template: StoryFn<SliderProps> = (args) => ( | ||
<Box sx={{ width: 300 }}> | ||
<Slider {...args} /> | ||
</Box>); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
valueLabelDisplay: 'off', | ||
marks: [], | ||
}; | ||
|
||
export const Percentage = Template.bind({}); | ||
Percentage.args = { | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
valueLabelDisplay: 'auto', | ||
marks: [{ value: 0, label: '0%' }, { value: 100, label: '100%'}] | ||
}; | ||
|
||
export const VisibleValue = Template.bind({}); | ||
VisibleValue.args = { | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
marks: [], | ||
valueLabelDisplay: 'on', | ||
}; | ||
|
||
export const Range = Template.bind({}); | ||
Range.args = { | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
marks: [], | ||
value: [20, 60], | ||
}; | ||
|
||
export default meta; |