feat: add state to table story for dynamic

This commit is contained in:
RadoslavDimchev 2023-11-16 00:41:10 +02:00
parent 6517d9db55
commit e393e60154
2 changed files with 39 additions and 24 deletions

View File

@ -1,24 +0,0 @@
import type { Meta, StoryObj } from '@storybook/react'
import ManagementTable from './ManagementTable'
import { VALIDATOR_TABS } from '../../../constants'
const meta = {
title: 'ValidatorManagement/ManagementTable',
component: ManagementTable,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
} satisfies Meta<typeof ManagementTable>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {
args: {
tab: VALIDATOR_TABS[0],
searchValue: '',
changeSearchValue: () => {},
},
}

View File

@ -0,0 +1,39 @@
import type { Meta, StoryObj } from '@storybook/react'
import ManagementTable from './ManagementTable'
import { VALIDATOR_TABS } from '../../../constants'
import { useState } from 'react'
const meta = {
title: 'ValidatorManagement/ManagementTable',
component: ManagementTable,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
} satisfies Meta<typeof ManagementTable>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = () => {
const [searchValue, setSearchValue] = useState('')
const changeSearchValue = (os: string) => {
setSearchValue(os)
}
return (
<ManagementTable
tab={VALIDATOR_TABS[0]}
searchValue={searchValue}
changeSearchValue={changeSearchValue}
/>
)
}
Default.args = {
tab: VALIDATOR_TABS[0],
searchValue: '',
changeSearchValue: () => {},
}