-
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
36 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,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> | ||
``` |