From ce6f6a984b374b189141116433ced80dfa0c2aae Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Thu, 13 Feb 2020 20:00:03 +0100 Subject: webui: move pages components --- webui/src/pages/list/BugRow.tsx | 113 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 webui/src/pages/list/BugRow.tsx (limited to 'webui/src/pages/list/BugRow.tsx') diff --git a/webui/src/pages/list/BugRow.tsx b/webui/src/pages/list/BugRow.tsx new file mode 100644 index 00000000..829877ef --- /dev/null +++ b/webui/src/pages/list/BugRow.tsx @@ -0,0 +1,113 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +import TableCell from '@material-ui/core/TableCell/TableCell'; +import TableRow from '@material-ui/core/TableRow/TableRow'; +import Tooltip from '@material-ui/core/Tooltip/Tooltip'; +import { makeStyles } from '@material-ui/core/styles'; +import CheckCircleOutline from '@material-ui/icons/CheckCircleOutline'; +import ErrorOutline from '@material-ui/icons/ErrorOutline'; + +import Date from 'src/components/Date'; +import Label from 'src/components/Label'; +import { Status } from 'src/gqlTypes'; + +import { BugRowFragment } from './BugRow.generated'; + +type OpenClosedProps = { className: string }; +const Open = ({ className }: OpenClosedProps) => ( + + + +); + +const Closed = ({ className }: OpenClosedProps) => ( + + + +); + +type StatusProps = { className: string; status: Status }; +const BugStatus: React.FC = ({ + status, + className, +}: StatusProps) => { + switch (status) { + case 'OPEN': + return ; + case 'CLOSED': + return ; + default: + return

{'unknown status ' + status}

; + } +}; + +const useStyles = makeStyles(theme => ({ + cell: { + display: 'flex', + alignItems: 'center', + padding: theme.spacing(1), + '& a': { + textDecoration: 'none', + }, + }, + status: { + margin: theme.spacing(1, 2), + }, + expand: { + width: '100%', + lineHeight: '20px', + }, + title: { + display: 'inline', + color: theme.palette.text.primary, + fontSize: '1.3rem', + fontWeight: 500, + }, + details: { + lineHeight: '1.5rem', + color: theme.palette.text.secondary, + }, + labels: { + paddingLeft: theme.spacing(1), + '& > *': { + display: 'inline-block', + }, + }, +})); + +type Props = { + bug: BugRowFragment; +}; + +function BugRow({ bug }: Props) { + const classes = useStyles(); + return ( + + + +
+ +
+ {bug.title} + {bug.labels.length > 0 && ( + + {bug.labels.map(l => ( + + )} +
+ +
+ {bug.humanId} opened + + by {bug.author.displayName} +
+
+
+
+ ); +} + +export default BugRow; -- cgit