-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): refactor banner component stories (#14894)
* refactor(app): refactor banner component stories
- Loading branch information
Showing
3 changed files
with
60 additions
and
50 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 |
---|---|---|
@@ -1,36 +1,41 @@ | ||
import * as React from 'react' | ||
import { StyledText, TYPOGRAPHY } from '@opentrons/components' | ||
import { Banner } from './index' | ||
import type { Story, Meta } from '@storybook/react' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
export default { | ||
const meta: Meta<typeof Banner> = { | ||
title: 'App/Atoms/Banner', | ||
component: Banner, | ||
} as Meta | ||
} | ||
|
||
export default meta | ||
|
||
const Template: Story<React.ComponentProps<typeof Banner>> = args => ( | ||
<Banner {...args}>{'Banner component'}</Banner> | ||
) | ||
type Story = StoryObj<typeof Banner> | ||
|
||
export const Primary = Template.bind({}) | ||
Primary.args = { | ||
title: 'title', | ||
type: 'success', | ||
export const Primary: Story = { | ||
args: { | ||
children: 'Banner component', | ||
type: 'success', | ||
}, | ||
} | ||
export const OverriddenIcon = Template.bind({}) | ||
OverriddenIcon.args = { | ||
type: 'warning', | ||
title: 'Alert with overridden icon', | ||
icon: { name: 'ot-hot-to-touch' }, | ||
|
||
export const OverriddenIcon: Story = { | ||
args: { | ||
type: 'warning', | ||
children: 'Banner component', | ||
icon: { name: 'ot-hot-to-touch' }, | ||
}, | ||
} | ||
export const OverriddenExitIcon = Template.bind({}) | ||
OverriddenExitIcon.args = { | ||
type: 'informing', | ||
title: 'Alert with overriden exit icon', | ||
onCloseClick: () => console.log('close'), | ||
closeButton: ( | ||
<StyledText as="p" textDecoration={TYPOGRAPHY.textDecorationUnderline}> | ||
{'Exit'} | ||
</StyledText> | ||
), | ||
|
||
export const OverriddenExitIcon: Story = { | ||
args: { | ||
type: 'informing', | ||
children: 'Banner component', | ||
onCloseClick: () => console.log('close'), | ||
closeButton: ( | ||
<StyledText as="p" textDecoration={TYPOGRAPHY.textDecorationUnderline}> | ||
{'Exit'} | ||
</StyledText> | ||
), | ||
}, | ||
} |
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