-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
21 deletions.
There are no files selected for viewing
77 changes: 56 additions & 21 deletions
77
src/components/LastUpdatedCell/LastUpdatedCell.stories.mdx
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,35 +1,70 @@ | ||
| import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks'; | ||
| import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks'; | ||
| import LastUpdatedCell from "./LastUpdatedCell"; | ||
|
|
||
| <Meta title="Components/LastUpdatedCell" component={LastUpdatedCell}/> | ||
| <Meta | ||
| title="Components/LastUpdatedCell" | ||
| component={LastUpdatedCell} | ||
| /> | ||
|
|
||
| # Today | ||
| Accepts a time and renders an [ItemTableCell](/?path=/docs/components-itemtablecell) with darker shades of red to show older items. | ||
|
|
||
| <Canvas> | ||
| <Story name="Today" args={{ | ||
| time:"2021-03-11T03:55:18+0000" | ||
| }}> | ||
| {args => <LastUpdatedCell {...args} />} | ||
| </Story> | ||
| </Canvas> | ||
|
|
||
| # Last Week | ||
| Time scales are: | ||
| - 1-6 days old | ||
| - 7-28 days old | ||
| - 29+ days old | ||
|
|
||
| <Canvas> | ||
| <Story name="Last Week" args={{ | ||
| time:"2021-03-03T03:55:18+0000" | ||
| }}> | ||
| {args => <LastUpdatedCell {...args} />} | ||
| <Story | ||
| name="Default" | ||
| args={{ | ||
| time: new Date(), | ||
| }} | ||
| > | ||
| { args => <LastUpdatedCell {...args} /> } | ||
| </Story> | ||
| <Story | ||
| name="7 Days Old" | ||
| args={{ | ||
| time: (_ => { | ||
| let today = new Date(); | ||
| let lastWeek = new Date().setDate(today.getDate() - 8); | ||
| return lastWeek; | ||
| })(), | ||
| }} | ||
| > | ||
| { args => <LastUpdatedCell {...args} /> } | ||
| </Story> | ||
| <Story | ||
| name="28 Days Old" | ||
| args={{ | ||
| time: (_ => { | ||
| let today = new Date(); | ||
| let lastWeek = new Date().setDate(today.getDate() - 29); | ||
| return lastWeek; | ||
| })(), | ||
| }} | ||
| > | ||
| { args => <LastUpdatedCell {...args} /> } | ||
| </Story> | ||
| </Canvas> | ||
|
|
||
| # Last Mounth | ||
| ## Forwarded ItemTableCell Props | ||
| Props can be passed to the [ItemTableCell](/?path=/docs/components-itemtablecell) component using the ItemTableCellProps prop. | ||
|
|
||
| <Canvas> | ||
| <Story name="Last Month" args={{ | ||
| time:"2021-02-10T03:55:18+0000" | ||
| }}> | ||
| {args => <LastUpdatedCell {...args} />} | ||
| <Story | ||
| name="With Forwarded props" | ||
| args={{ | ||
| time: new Date(), | ||
| ItemTableCellProps: { | ||
| TableCellProps: { | ||
| size: "small" | ||
| } | ||
| } | ||
| }} | ||
| > | ||
| { args => <LastUpdatedCell {...args} /> } | ||
| </Story> | ||
| </Canvas> | ||
|
|
||
| <ArgsTable of={LastUpdatedCell} /> |