Skip to content

Commit

Permalink
Update LastUpdatedCell stories
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Apr 19, 2021
1 parent 9ea0c53 commit 9dd19a9
Showing 1 changed file with 56 additions and 21 deletions.
77 changes: 56 additions & 21 deletions src/components/LastUpdatedCell/LastUpdatedCell.stories.mdx
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} />

0 comments on commit 9dd19a9

Please sign in to comment.