From fe2ebf885ba5d1acb74b05acd42152a5ec9fa142 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Mon, 12 Oct 2020 22:55:54 -0400 Subject: [PATCH] Create Assignment component w/ docs --- src/components/Assignment/Assignment.js | 21 ++++++++++++++++++++ src/components/Assignment/Assignment.md | 26 +++++++++++++++++++++++++ src/components/Assignment/index.js | 1 + 3 files changed, 48 insertions(+) create mode 100644 src/components/Assignment/Assignment.js create mode 100644 src/components/Assignment/Assignment.md create mode 100644 src/components/Assignment/index.js diff --git a/src/components/Assignment/Assignment.js b/src/components/Assignment/Assignment.js new file mode 100644 index 0000000..492861f --- /dev/null +++ b/src/components/Assignment/Assignment.js @@ -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 ( + + {by} assigned this to {to} + + ); +} + +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 +} \ No newline at end of file diff --git a/src/components/Assignment/Assignment.md b/src/components/Assignment/Assignment.md new file mode 100644 index 0000000..eaaa150 --- /dev/null +++ b/src/components/Assignment/Assignment.md @@ -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" +}; + + + +``` + +```jsx static +const example_assignment = { + "type": "assignment", + "datetime": "2020-06-23T13:27:00-0400", + "by": "campb303", + "to": "campb303" +}; + + +``` \ No newline at end of file diff --git a/src/components/Assignment/index.js b/src/components/Assignment/index.js new file mode 100644 index 0000000..f3e1b8b --- /dev/null +++ b/src/components/Assignment/index.js @@ -0,0 +1 @@ +export { default } from "./Assignment"; \ No newline at end of file