-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adapt storybook v7, remove deprecations[ComponentStory, storiesOf]
- Loading branch information
Showing
48 changed files
with
1,335 additions
and
954 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -15,7 +15,4 @@ export default { | |
docs: { | ||
autodocs: true | ||
}, | ||
features: { | ||
storyStoreV7: false, | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import React from 'react' | ||
import { ComponentStory } from '@storybook/react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import Addresses from 'components/Addresses' | ||
import { withRouter } from 'storybook-addon-react-router-v6' | ||
import addressesStates from './data/addresses' | ||
|
||
export default { | ||
title: 'Addresses', | ||
const meta: Meta<typeof Addresses> = { | ||
component: Addresses, | ||
decorators: [withRouter], | ||
argTypes: { | ||
wallet: { control: 'object', isGlobal: true }, | ||
}, | ||
} | ||
export default meta | ||
|
||
const Template: ComponentStory<typeof Addresses> = () => <Addresses /> | ||
type Story = StoryObj<typeof Addresses> | ||
|
||
export const ContentList = Template.bind({}) | ||
ContentList.args = { wallet: { addresses: addressesStates['Content List'] } } | ||
export const ContentList: Story = { | ||
args: { | ||
wallet: { addresses: addressesStates['Content List'] }, | ||
}, | ||
} | ||
|
||
export const EmptyList = Template.bind({}) | ||
export const EmptyList: Story = {} |
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 |
---|---|---|
@@ -1,24 +1,18 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import AlertDialog from 'widgets/AlertDialog' | ||
|
||
const props = { | ||
show: true, | ||
title: 'This is the title of alert dialog', | ||
message: | ||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | ||
dispatch: () => {}, | ||
const meta: Meta<typeof AlertDialog> = { | ||
component: AlertDialog, | ||
args: { | ||
title: 'This is the title of alert dialog', | ||
message: 'Here is the alert dialog message', | ||
type: 'success', | ||
show: false, | ||
}, | ||
} | ||
|
||
const stories = storiesOf('Alert Dialog', module) | ||
stories.add('basic alert dialog', () => { | ||
return <AlertDialog {...props} type="failed" /> | ||
}) | ||
export default meta | ||
|
||
stories.add('basic alert dialog', () => { | ||
return <AlertDialog {...props} type="success" /> | ||
}) | ||
type Story = StoryObj<typeof AlertDialog> | ||
|
||
stories.add('basic alert dialog', () => { | ||
return <AlertDialog {...props} type="warning" /> | ||
}) | ||
export const Default: Story = {} |
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import Balance from 'widgets/Balance' | ||
|
||
const balances = ['0', '0.00000001', '0.99999999', '1', '1.000000001', '111111111111111111111111111111111.111111111111'] | ||
const meta: Meta<typeof Balance> = { | ||
component: Balance, | ||
args: { | ||
balance: '0', | ||
}, | ||
} | ||
|
||
const stories = storiesOf('Balance', module) | ||
balances.forEach(balance => { | ||
stories.add(`Balance ${balance} CKB`, () => { | ||
return <Balance balance={balance} /> | ||
}) | ||
}) | ||
export default meta | ||
|
||
type Story = StoryObj<typeof Balance> | ||
|
||
export const Default: Story = { | ||
args: { | ||
balance: '0.00000001', | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,37 +1,48 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { withRouter } from 'storybook-addon-react-router-v6' | ||
import Breadcrum, { BreadcumProps } from 'widgets/Breadcrum' | ||
import Breadcrum from 'widgets/Breadcrum' | ||
|
||
const stories = storiesOf('Breadcum', module).addDecorator(withRouter()) | ||
const meta: Meta<typeof Breadcrum> = { | ||
component: Breadcrum, | ||
decorators: [withRouter()], | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof Breadcrum> | ||
|
||
export const Empty: Story = { | ||
args: { | ||
pages: [], | ||
}, | ||
} | ||
|
||
const propsList: { [name: string]: BreadcumProps } = { | ||
empty: { pages: [] }, | ||
root: { | ||
export const Root: Story = { | ||
args: { | ||
pages: [ | ||
{ | ||
label: 'root', | ||
link: 'root', | ||
}, | ||
], | ||
}, | ||
'2 layers': { | ||
} | ||
|
||
export const TwoLayers: Story = { | ||
args: { | ||
pages: [ | ||
{ label: 'root', link: 'root' }, | ||
{ label: 'first', link: 'first' }, | ||
], | ||
}, | ||
'3 layers': { | ||
} | ||
|
||
export const ThreeLayers: Story = { | ||
args: { | ||
pages: [ | ||
{ label: 'root', link: 'root' }, | ||
{ label: 'first', link: 'first' }, | ||
{ label: 'second', link: 'second' }, | ||
], | ||
}, | ||
} | ||
|
||
Object.entries(propsList).forEach(([name, props]) => { | ||
stories.add(name, () => { | ||
return <Breadcrum {...props} /> | ||
}) | ||
}) |
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
50 changes: 25 additions & 25 deletions
50
packages/neuron-ui/src/stories/CompensationProgressBar.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 |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import React from 'react' | ||
import { ComponentStory } from '@storybook/react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import CompensationProgressBar from 'components/CompensationProgressBar' | ||
|
||
export default { | ||
title: 'Compensation Progress Bar', | ||
const meta: Meta<typeof CompensationProgressBar> = { | ||
component: CompensationProgressBar, | ||
args: { | ||
style: { width: '300px' }, | ||
}, | ||
} | ||
|
||
const Template: ComponentStory<typeof CompensationProgressBar> = (args: any) => ( | ||
<CompensationProgressBar style={{ width: '300px' }} {...args} /> | ||
) | ||
export default meta | ||
|
||
export const Normal = Template.bind({}) | ||
Normal.args = { currentEpochValue: 0, endEpochValue: 180 } | ||
type Story = StoryObj<typeof CompensationProgressBar> | ||
|
||
export const Suggested = Template.bind({}) | ||
Suggested.args = { currentEpochValue: 139, endEpochValue: 180 } | ||
export const Normal: Story = { | ||
args: { currentEpochValue: 0, endEpochValue: 180 }, | ||
} | ||
|
||
export const Requested = Template.bind({}) | ||
Requested.args = { currentEpochValue: 175, endEpochValue: 180 } | ||
export const Suggested: Story = { | ||
args: { currentEpochValue: 139, endEpochValue: 180 }, | ||
} | ||
|
||
export const End = Template.bind({}) | ||
End.args = { currentEpochValue: 180, endEpochValue: 180 } | ||
export const Requested: Story = { | ||
args: { currentEpochValue: 175, endEpochValue: 180 }, | ||
} | ||
|
||
export const WithdrawnInPeriod = Template.bind({}) | ||
WithdrawnInPeriod.args = { currentEpochValue: 160, endEpochValue: 180, withdrawEpochValue: 30 } | ||
export const End: Story = { args: { currentEpochValue: 180, endEpochValue: 180 } } | ||
|
||
export const WithdrawnOuterPeriod = Template.bind({}) | ||
WithdrawnOuterPeriod.args = { currentEpochValue: 181, endEpochValue: 180, withdrawEpochValue: 30 } | ||
export const WithdrawnInPeriod: Story = { args: { currentEpochValue: 160, endEpochValue: 180, withdrawEpochValue: 30 } } | ||
|
||
export const WithdrawnOuterPeriod: Story = { | ||
args: { currentEpochValue: 181, endEpochValue: 180, withdrawEpochValue: 30 }, | ||
} | ||
|
||
export const CurrentLessThanEnd = Template.bind({}) | ||
CurrentLessThanEnd.args = { currentEpochValue: 181, endEpochValue: 180 } | ||
export const CurrentLessThanEnd: Story = { args: { currentEpochValue: 181, endEpochValue: 180 } } | ||
|
||
export const CurrentLessThanBegin = Template.bind({}) | ||
CurrentLessThanBegin.args = { currentEpochValue: 0, endEpochValue: 181 } | ||
export const CurrentLessThanBegin: Story = { args: { currentEpochValue: 0, endEpochValue: 181 } } | ||
|
||
export const Pending = Template.bind({}) | ||
Pending.args = { pending: true, currentEpochValue: 0, endEpochValue: 0 } | ||
export const Pending: Story = { args: { pending: true, currentEpochValue: 0, endEpochValue: 0 } } |
Oops, something went wrong.