aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages/bug/Message.tsx
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-23 14:49:09 +0100
committerGitHub <noreply@github.com>2020-02-23 14:49:09 +0100
commitf87d63b3c656f6efba3c62c121f66e513ca3efea (patch)
tree368886eb57bab83c76f73b3b7b0238b483733a30 /webui/src/pages/bug/Message.tsx
parent4559af5e71a2d6d1c53329e565d101c3eadacf6e (diff)
parentf96484391ae817a18f503b5c31cd3bd2211553df (diff)
downloadgit-bug-f87d63b3c656f6efba3c62c121f66e513ca3efea.tar.gz
Merge pull request #331 from MichaelMure/webui/mutations
Webui: add comments
Diffstat (limited to 'webui/src/pages/bug/Message.tsx')
-rw-r--r--webui/src/pages/bug/Message.tsx80
1 files changed, 80 insertions, 0 deletions
diff --git a/webui/src/pages/bug/Message.tsx b/webui/src/pages/bug/Message.tsx
new file mode 100644
index 00000000..4a438b77
--- /dev/null
+++ b/webui/src/pages/bug/Message.tsx
@@ -0,0 +1,80 @@
+import React from 'react';
+
+import Paper from '@material-ui/core/Paper';
+import { makeStyles } from '@material-ui/core/styles';
+
+import Author, { Avatar } from 'src/components/Author';
+import Content from 'src/components/Content';
+import Date from 'src/components/Date';
+
+import { AddCommentFragment } from './MessageCommentFragment.generated';
+import { CreateFragment } from './MessageCreateFragment.generated';
+
+const useStyles = makeStyles(theme => ({
+ author: {
+ fontWeight: 'bold',
+ },
+ container: {
+ display: 'flex',
+ },
+ avatar: {
+ marginTop: 2,
+ },
+ bubble: {
+ flex: 1,
+ marginLeft: theme.spacing(1),
+ minWidth: 0,
+ },
+ header: {
+ ...theme.typography.body1,
+ color: '#444',
+ padding: '0.5rem 1rem',
+ borderBottom: '1px solid #ddd',
+ display: 'flex',
+ backgroundColor: '#e2f1ff',
+ },
+ title: {
+ flex: 1,
+ },
+ tag: {
+ ...theme.typography.button,
+ color: '#888',
+ border: '#ddd solid 1px',
+ padding: '0 0.5rem',
+ fontSize: '0.75rem',
+ borderRadius: 2,
+ marginLeft: '0.5rem',
+ },
+ body: {
+ ...theme.typography.body2,
+ padding: '0 1rem',
+ },
+}));
+
+type Props = {
+ op: AddCommentFragment | CreateFragment;
+};
+
+function Message({ op }: Props) {
+ const classes = useStyles();
+ return (
+ <article className={classes.container}>
+ <Avatar author={op.author} className={classes.avatar} />
+ <Paper elevation={1} className={classes.bubble}>
+ <header className={classes.header}>
+ <div className={classes.title}>
+ <Author className={classes.author} author={op.author} />
+ <span> commented </span>
+ <Date date={op.createdAt} />
+ </div>
+ {op.edited && <div className={classes.tag}>Edited</div>}
+ </header>
+ <section className={classes.body}>
+ <Content markdown={op.message} />
+ </section>
+ </Paper>
+ </article>
+ );
+}
+
+export default Message;