Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jan 21, 2021
1 parent 9df197e commit 246e4d9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/components/LastUpdatedCell/LastUpdatedCell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
The LastUpdatedCell wraps an [ItemTableCell](/#/Components/ItemTableCell) and changes its background color based on the time passed to it to indicate how old an item is.

## Default Usage
```jsx
import { Paper } from '@material-ui/core';
import LastUpdatedCell from "./LastUpdatedCell";

let today = new Date();
let threeDaysAgo = new Date().setDate(today.getDate() - 3);
let lastWeek = new Date().setDate(today.getDate() - 8);
let lastMonth = new Date().setDate(today.getDate() - 28);

<Paper>
{ /* Today */ }
<LastUpdatedCell time={today} />
{ /* Three Days Ago */ }
<LastUpdatedCell time={threeDaysAgo} />
{ /* Last Week */ }
<LastUpdatedCell time={lastWeek} />
{ /* Last Month */ }
<LastUpdatedCell time={lastMonth} />
</Paper>
```

```jsx static
<Paper>
{ /* Today */ }
<LastUpdatedCell time={today} />
{ /* Three Days Ago */ }
<LastUpdatedCell time={threeDaysAgo} />
{ /* Last Week */ }
<LastUpdatedCell time={lastWeek} />
{ /* Last Month */ }
<LastUpdatedCell time={lastMonth} />
</Paper>
```

0 comments on commit 246e4d9

Please sign in to comment.