diff --git a/src/components/Edit/Edit.md b/src/components/Edit/Edit.md deleted file mode 100644 index c3643f4..0000000 --- a/src/components/Edit/Edit.md +++ /dev/null @@ -1,29 +0,0 @@ -Renders a message box style representation of an edit. - -```jsx -import { ThemeProvider } from "@material-ui/core/styles"; -import webqueue2Theme from "../../theme"; -import Edit from "./Edit"; - -const theme = webqueue2Theme(false); - - - - -``` - -```jsx static - -``` \ No newline at end of file diff --git a/src/components/Edit/index.js b/src/components/Edit/index.js deleted file mode 100644 index 912ccd5..0000000 --- a/src/components/Edit/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Edit"; \ No newline at end of file diff --git a/src/components/Edit/Edit.js b/src/components/TimelineActionCard/TimelineActionCard.js similarity index 61% rename from src/components/Edit/Edit.js rename to src/components/TimelineActionCard/TimelineActionCard.js index 690ca35..431cd3e 100644 --- a/src/components/Edit/Edit.js +++ b/src/components/TimelineActionCard/TimelineActionCard.js @@ -4,16 +4,27 @@ import { Typography, Paper, makeStyles, useTheme } from '@material-ui/core'; import clsx from "clsx"; import RelativeTime from "react-relative-time"; -export default function Edit({ datetime, by, content }){ +export default function TimelineActionCard({ type, datetime, by, content }){ const theme = useTheme(); + const types = { + "edit": { + "verbage": "added an edit", + "coloring": theme.palette.edit.main + }, + "reply_to_user": { + "verbage": "replied", + "coloring": theme.palette.reply_to_user.main + } + } + const useStyles = makeStyles({ "Paper-root": { overflow: "hidden" }, "headerColor": { - backgroundColor: theme.palette.edit.main + backgroundColor: types[type].coloring }, "padding": { padding: theme.spacing(1) @@ -25,7 +36,7 @@ export default function Edit({ datetime, by, content }){ return(
- {by} added an edit + {by} {types[type].verbage}
{content.map((line) => ( @@ -36,11 +47,19 @@ export default function Edit({ datetime, by, content }){ ); } -Edit.propTypes = { +TimelineActionCard.propTypes = { + "type": PropTypes.oneOf([ + "edit", + "reply_to_user" + ]), /** ISO 8601 formatted time string. */ "datetime": PropTypes.string.isRequired, /** The name of the person who added the edit. */ "by": PropTypes.string.isRequired, /** An array of strings containing the content of the edit. */ "content": PropTypes.array.isRequired -} \ No newline at end of file +}; + +TimelineActionCard.defaultProps = { + "type": "edit", +}; \ No newline at end of file diff --git a/src/components/TimelineActionCard/TimelineActionCard.md b/src/components/TimelineActionCard/TimelineActionCard.md new file mode 100644 index 0000000..7c8a8ee --- /dev/null +++ b/src/components/TimelineActionCard/TimelineActionCard.md @@ -0,0 +1,60 @@ +Renders a card like view for an action with free form text content like an Edit or Reply. + +```jsx +import { ThemeProvider } from "@material-ui/core/styles"; +import webqueue2Theme from "../../theme"; +import TimelineActionCard from "./TimelineActionCard"; + +const theme = webqueue2Theme(false); + + +
+
+ +
+
+ +
+
+
+``` + +```jsx static + + + +``` \ No newline at end of file diff --git a/src/components/TimelineActionCard/index.js b/src/components/TimelineActionCard/index.js new file mode 100644 index 0000000..48454f2 --- /dev/null +++ b/src/components/TimelineActionCard/index.js @@ -0,0 +1 @@ +export { default } from "./TimelineActionCard"; \ No newline at end of file