-
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
Justin Campbell
committed
Oct 13, 2020
1 parent
08e2672
commit fe2ebf8
Showing
3 changed files
with
48 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,21 @@ | ||
| import React from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import { Typography } from "@material-ui/core"; | ||
| import RelativeTime from "react-relative-time"; | ||
|
|
||
| export default function Assignment({ by, to, datetime }){ | ||
| return ( | ||
| <Typography> | ||
| <b>{by}</b> assigned this to <b>{to}</b> <RelativeTime value={new Date(datetime)} /> | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| Assignment.propTypes = { | ||
| /** The person who changed the assignment. */ | ||
| "by": PropTypes.string.isRequired, | ||
| /** The person the item was assigned to. */ | ||
| "to": PropTypes.string.isRequired, | ||
| /** The time the assignment was changed in ISO 8601 format. */ | ||
| "datetime": PropTypes.string.isRequired | ||
| } |
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,26 @@ | ||
| Renders a string representation of an assignment with a relative time. | ||
|
|
||
| ```jsx | ||
| import Assignment from "./Assignment"; | ||
|
|
||
| const example_assignment = { | ||
| "type": "assignment", | ||
| "datetime": "2020-06-23T13:27:00-0400", | ||
| "by": "campb303", | ||
| "to": "campb303" | ||
| }; | ||
|
|
||
| <Assignment {...example_assignment} /> | ||
|
|
||
| ``` | ||
|
|
||
| ```jsx static | ||
| const example_assignment = { | ||
| "type": "assignment", | ||
| "datetime": "2020-06-23T13:27:00-0400", | ||
| "by": "campb303", | ||
| "to": "campb303" | ||
| }; | ||
|
|
||
| <Assignment {...example_assignment} /> | ||
| ``` |
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 @@ | ||
| export { default } from "./Assignment"; |