diff --git a/packages/redux-devtools-ui/src/Button/Button.stories.tsx b/packages/redux-devtools-ui/src/Button/Button.stories.tsx index 3ac47574..a8e32f58 100644 --- a/packages/redux-devtools-ui/src/Button/Button.stories.tsx +++ b/packages/redux-devtools-ui/src/Button/Button.stories.tsx @@ -1,15 +1,16 @@ import React from 'react'; import styled from 'styled-components'; import { MdFiberManualRecord } from 'react-icons/md'; -import { Story } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import Button from './'; -import { ButtonProps } from './Button'; -export default { +const meta: Meta = { title: 'Button', component: Button, }; +export default meta; + const Container = styled.div` display: flex; height: 100%; @@ -18,41 +19,45 @@ const Container = styled.div` align-items: center; `; -const Template: Story = (args) => ( - - - - - - - + + + ), + args: { + borderPosition: 'top', + title: 'Hello Tooltip', + tooltipPosition: 'top', + disabled: false, + label: 'Hello Button', }, - tooltipPosition: { - control: { - type: 'select', - options: [ - 'top', - 'bottom', - 'left', - 'right', - 'bottom-left', - 'bottom-right', - 'top-left', - 'top-right', - ], + argTypes: { + borderPosition: { + control: { + type: 'select', + options: ['top', 'bottom'], + }, + }, + tooltipPosition: { + control: { + type: 'select', + options: [ + 'top', + 'bottom', + 'left', + 'right', + 'bottom-left', + 'bottom-right', + 'top-left', + 'top-right', + ], + }, + }, + onClick: { + action: 'button clicked', }, - }, - onClick: { - action: 'button clicked', }, }; @@ -136,96 +138,96 @@ interface TabsTemplateArgs { position: Position; } -const TabsTemplate: Story = ({ - // eslint-disable-next-line react/prop-types - title, - // eslint-disable-next-line react/prop-types - tooltipPosition, - // eslint-disable-next-line react/prop-types - disabled, - // eslint-disable-next-line react/prop-types - buttonOnClick, - // eslint-disable-next-line react/prop-types - label, - // eslint-disable-next-line react/prop-types - selected, - // eslint-disable-next-line react/prop-types - main, - // eslint-disable-next-line react/prop-types - tabsOnClick, - // eslint-disable-next-line react/prop-types - collapsible, - // eslint-disable-next-line react/prop-types - position, - // eslint-disable-next-line react/prop-types -}) => ( - - - - - - - -); - -export const Tabs = TabsTemplate.bind({}); -Tabs.args = { - title: 'Hello Tooltip', - tooltipPosition: 'top', - disabled: false, - label: 'Hello Button', - selected: '2', - main: true, - collapsible: true, - position: 'center', -}; -Tabs.argTypes = { - tooltipPosition: { - control: { - type: 'select', - options: [ - 'top', - 'bottom', - 'left', - 'right', - 'bottom-left', - 'bottom-right', - 'top-left', - 'top-right', - ], +export const Tabs: StoryObj = { + render: ({ + // eslint-disable-next-line react/prop-types + title, + // eslint-disable-next-line react/prop-types + tooltipPosition, + // eslint-disable-next-line react/prop-types + disabled, + // eslint-disable-next-line react/prop-types + buttonOnClick, + // eslint-disable-next-line react/prop-types + label, + // eslint-disable-next-line react/prop-types + selected, + // eslint-disable-next-line react/prop-types + main, + // eslint-disable-next-line react/prop-types + tabsOnClick, + // eslint-disable-next-line react/prop-types + collapsible, + // eslint-disable-next-line react/prop-types + position, + // eslint-disable-next-line react/prop-types + }) => ( + + + + + + + + ), + args: { + title: 'Hello Tooltip', + tooltipPosition: 'top', + disabled: false, + label: 'Hello Button', + selected: '2', + main: true, + collapsible: true, + position: 'center', + }, + argTypes: { + tooltipPosition: { + control: { + type: 'select', + options: [ + 'top', + 'bottom', + 'left', + 'right', + 'bottom-left', + 'bottom-right', + 'top-left', + 'top-right', + ], + }, }, - }, - buttonOnClick: { - action: 'button clicked', - }, - tabsOnClick: { - action: 'tab selected', - }, - position: { - control: { - type: 'select', - options: ['left', 'right', 'center'], + buttonOnClick: { + action: 'button clicked', + }, + tabsOnClick: { + action: 'tab selected', + }, + position: { + control: { + type: 'select', + options: ['left', 'right', 'center'], + }, }, }, }; @@ -246,123 +248,123 @@ interface WithSliderTemplateArgs { segmentedControlOnClick: (value: string) => void; } -const WithSliderTemplate: Story = ({ - // eslint-disable-next-line react/prop-types - title, - // eslint-disable-next-line react/prop-types - tooltipPosition, - // eslint-disable-next-line react/prop-types - playOnClick, - // eslint-disable-next-line react/prop-types - value, - // eslint-disable-next-line react/prop-types - min, - // eslint-disable-next-line react/prop-types - max, - // eslint-disable-next-line react/prop-types - label, - // eslint-disable-next-line react/prop-types - withValue, - // eslint-disable-next-line react/prop-types - onChange, - // eslint-disable-next-line react/prop-types - previousStateOnClick, - // eslint-disable-next-line react/prop-types - nextStateOnClick, - // eslint-disable-next-line react/prop-types - selected, - // eslint-disable-next-line react/prop-types - segmentedControlOnClick, -}) => ( - - - - - - - - - - - -); - -export const WithSlider = WithSliderTemplate.bind({}); -WithSlider.args = { - title: 'Play', - tooltipPosition: 'top', - value: 80, - min: 0, - max: 100, - label: 'Slider label', - withValue: false, - selected: 'live', -}; -WithSlider.argTypes = { - tooltipPosition: { - control: { - type: 'select', - options: [ - 'top', - 'bottom', - 'left', - 'right', - 'bottom-left', - 'bottom-right', - 'top-left', - 'top-right', - ], +export const WithSlider: StoryObj = { + render: ({ + // eslint-disable-next-line react/prop-types + title, + // eslint-disable-next-line react/prop-types + tooltipPosition, + // eslint-disable-next-line react/prop-types + playOnClick, + // eslint-disable-next-line react/prop-types + value, + // eslint-disable-next-line react/prop-types + min, + // eslint-disable-next-line react/prop-types + max, + // eslint-disable-next-line react/prop-types + label, + // eslint-disable-next-line react/prop-types + withValue, + // eslint-disable-next-line react/prop-types + onChange, + // eslint-disable-next-line react/prop-types + previousStateOnClick, + // eslint-disable-next-line react/prop-types + nextStateOnClick, + // eslint-disable-next-line react/prop-types + selected, + // eslint-disable-next-line react/prop-types + segmentedControlOnClick, + }) => ( + + + + + + + + + + + + ), + args: { + title: 'Play', + tooltipPosition: 'top', + value: 80, + min: 0, + max: 100, + label: 'Slider label', + withValue: false, + selected: 'live', + }, + argTypes: { + tooltipPosition: { + control: { + type: 'select', + options: [ + 'top', + 'bottom', + 'left', + 'right', + 'bottom-left', + 'bottom-right', + 'top-left', + 'top-right', + ], + }, + }, + playOnClick: { + action: 'button clicked', + }, + onChange: { + action: 'slider changed', + }, + previousStateOnClick: { + action: 'previous state clicked', + }, + nextStateOnClick: { + action: 'next state clicked', + }, + selected: { + control: { + type: 'select', + options: ['live', '1x'], + }, + }, + segmentedControlOnClick: { + action: 'button selected', }, }, - playOnClick: { - action: 'button clicked', - }, - onChange: { - action: 'slider changed', - }, - previousStateOnClick: { - action: 'previous state clicked', - }, - nextStateOnClick: { - action: 'next state clicked', - }, - selected: { - control: { - type: 'select', - options: ['live', '1x'], - }, - }, - segmentedControlOnClick: { - action: 'button selected', - }, };