-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [M3-8170] - Add CheckoutBar Story (#10784)
- Loading branch information
1 parent
15e3506
commit 43366ac
Showing
3 changed files
with
109 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Added | ||
--- | ||
|
||
CheckoutBar Story ([#10784](https://github.com/linode/manager/pull/10784)) |
70 changes: 70 additions & 0 deletions
70
packages/manager/src/components/CheckoutBar/CheckoutBar.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from 'react'; | ||
|
||
import { Typography } from 'src/components/Typography'; | ||
|
||
import { CheckoutBar } from './CheckoutBar'; | ||
|
||
import type { Meta, StoryFn, StoryObj } from '@storybook/react'; | ||
|
||
type Story = StoryObj<typeof CheckoutBar>; | ||
|
||
const Item = ({ children }: { children?: React.ReactNode }) => ( | ||
<Typography sx={{ fontStyle: 'italic' }}>{children}</Typography> | ||
); | ||
|
||
const defaultArgs = { | ||
calculatedPrice: 30.0, | ||
children: <Item>Child items can go here!</Item>, | ||
heading: 'Checkout', | ||
onDeploy: () => alert('Deploy clicked'), | ||
submitText: 'Submit', | ||
}; | ||
|
||
const meta: Meta<typeof CheckoutBar> = { | ||
argTypes: { | ||
onDeploy: { action: 'onDeploy' }, | ||
}, | ||
component: CheckoutBar, | ||
decorators: [ | ||
(Story: StoryFn) => ( | ||
<div style={{ margin: '2em' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
title: 'Components/CheckoutBar', | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = { | ||
args: defaultArgs, | ||
}; | ||
|
||
export const WithAgreement: Story = { | ||
args: { | ||
...defaultArgs, | ||
agreement: <Item>Agreement item can go here!</Item>, | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
...defaultArgs, | ||
disabled: true, | ||
}, | ||
}; | ||
|
||
export const Loading: Story = { | ||
args: { | ||
...defaultArgs, | ||
isMakingRequest: true, | ||
}, | ||
}; | ||
|
||
export const WithFooter: Story = { | ||
args: { | ||
...defaultArgs, | ||
footer: <Item>Footer element can go here!</Item>, | ||
}, | ||
}; |
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