diff --git a/ui/components/ui/slider/README.mdx b/ui/components/ui/slider/README.mdx new file mode 100644 index 000000000..29c8c4378 --- /dev/null +++ b/ui/components/ui/slider/README.mdx @@ -0,0 +1,37 @@ +import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; + +import Slider from '.'; + +# Slider + +Slider component to choose a value from predefined range of values. + + + + + +## Usage + +### With Steps + +Slider with predefined total steps + + + + + +### With Header + +Slider with header title + + + + + +### With Footer + +Slider with footer + + + + diff --git a/ui/components/ui/slider/slider.component.js b/ui/components/ui/slider/slider.component.js index 9bdb7309b..ef722662f 100644 --- a/ui/components/ui/slider/slider.component.js +++ b/ui/components/ui/slider/slider.component.js @@ -118,17 +118,53 @@ Slider.defaultProps = { }; Slider.propTypes = { + /** + * Show edit text + */ editText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Show info text + */ infoText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Show title detail text + */ titleDetail: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Show title text + */ titleText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Show tooltip Text + */ tooltipText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Show value text + */ valueText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + /** + * Set maximum step + */ max: PropTypes.number, + /** + * Set minimum step + */ min: PropTypes.number, + /** + * Handler for onChange + */ onChange: PropTypes.func, + /** + * Handler for onEdit + */ onEdit: PropTypes.func, + /** + * Total steps + */ step: PropTypes.number, + /** + * Show value on slider + */ value: PropTypes.number, }; diff --git a/ui/components/ui/slider/slider.stories.js b/ui/components/ui/slider/slider.stories.js index b9bd3fdaa..a41f71a68 100644 --- a/ui/components/ui/slider/slider.stories.js +++ b/ui/components/ui/slider/slider.stories.js @@ -1,36 +1,53 @@ import React from 'react'; -import { action } from '@storybook/addon-actions'; +import README from './README.mdx'; import Slider from '.'; export default { title: 'Components/UI/Slider', id: __filename, + component: Slider, + parameters: { + docs: { + page: README, + }, + }, + argTypes: { + editText: { control: 'text' }, + infoText: { control: 'text' }, + titleDetail: { control: 'text' }, + titleText: { control: 'text' }, + tooltipText: { control: 'text' }, + valueText: { control: 'text' }, + max: { control: 'number' }, + min: { control: 'number' }, + onChange: { action: 'onChange' }, + onEdit: { action: 'onEdit' }, + step: { control: 'number' }, + value: { control: 'number' }, + }, }; -export const DefaultStory = () => ; - +export const DefaultStory = (args) => ; DefaultStory.storyName = 'Default'; -export const WithSteps = () => ; +export const WithSteps = (args) => ; +WithSteps.args = { + step: 10, +}; -export const WithHeader = () => ( - -); +export const WithHeader = (args) => ; +WithHeader.args = { + titleText: 'Slider Title Text', + tooltipText: 'Slider Tooltip Text', + valueText: '$ 00.00', + titleDetail: '100 GWEI', +}; -export const WithFooter = () => ( - { - action('On edit click')(); - }} - /> -); +export const WithFooter = (args) => ; +WithFooter.args = { + titleText: 'Slider Title Text', + tooltipText: 'Slider Tooltip Text', + valueText: '$ 00.00', + titleDetail: '100 GWEI', + infoText: 'Footer Info Text', +};