aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webui/src/App.tsx2
-rw-r--r--webui/src/components/Button/GBButton.css19
-rw-r--r--webui/src/components/Button/GBButton.tsx22
-rw-r--r--webui/src/pages/list/ListQuery.css20
-rw-r--r--webui/src/pages/list/ListQuery.tsx6
-rw-r--r--webui/src/pages/new/NewPage.tsx80
6 files changed, 126 insertions, 23 deletions
diff --git a/webui/src/App.tsx b/webui/src/App.tsx
index 16663870..f7df7d2b 100644
--- a/webui/src/App.tsx
+++ b/webui/src/App.tsx
@@ -4,12 +4,14 @@ import { Route, Switch } from 'react-router';
import Layout from './layout';
import BugPage from './pages/bug';
import ListPage from './pages/list';
+import NewPage from './pages/new/NewPage';
export default function App() {
return (
<Layout>
<Switch>
<Route path="/" exact component={ListPage} />
+ <Route path="/new" exact component={NewPage} />
<Route path="/bug/:id" exact component={BugPage} />
</Switch>
</Layout>
diff --git a/webui/src/components/Button/GBButton.css b/webui/src/components/Button/GBButton.css
new file mode 100644
index 00000000..1f47fee4
--- /dev/null
+++ b/webui/src/components/Button/GBButton.css
@@ -0,0 +1,19 @@
+.bt-issue {
+ background-color: #2ea44fd9;
+ border: 1px solid;
+ border-color: #1b1f2326;
+ border-radius: 6px;
+ padding: 6px 12px;
+
+ font-size: 14px;
+ color: #ffffff;
+ line-height: 20px;
+ text-decoration: none;
+
+ transition: all 0.2s cubic-bezier(0.3, 0, 0.5, 1);
+}
+
+.bt-issue:hover {
+ background-color: #2ea44f;
+ border-color: #1b1f2326;
+} \ No newline at end of file
diff --git a/webui/src/components/Button/GBButton.tsx b/webui/src/components/Button/GBButton.tsx
new file mode 100644
index 00000000..fcbff7a0
--- /dev/null
+++ b/webui/src/components/Button/GBButton.tsx
@@ -0,0 +1,22 @@
+import React from 'react';
+import { Link } from 'react-router-dom';
+
+import './GBButton.css';
+
+interface GBButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
+ to: string;
+ text: string;
+}
+
+/**
+ * Standard button for issue actions
+ */
+const GBButton: React.FC<GBButtonProps> = (props) => {
+ return (
+ <Link to={props.to} className="bt-issue">
+ {props.text}
+ </Link>
+ );
+};
+
+export default GBButton;
diff --git a/webui/src/pages/list/ListQuery.css b/webui/src/pages/list/ListQuery.css
index 36d94289..4f7abaf3 100644
--- a/webui/src/pages/list/ListQuery.css
+++ b/webui/src/pages/list/ListQuery.css
@@ -14,24 +14,4 @@ label {
flex-direction: row;
align-items: flex-start;
justify-content: left;
-}
-
-.bt-new-issue {
- background-color: #2ea44fd9;
- border: 1px solid;
- border-color: #1b1f2326;
- border-radius: 6px;
- padding: 6px 12px;
-
- font-size: 14px;
- color: #ffffff;
- line-height: 20px;
- text-decoration: none;
-
- transition: all 0.2s cubic-bezier(0.3, 0, 0.5, 1);
-}
-
-.bt-new-issue:hover {
- background-color: #2ea44f;
- border-color: #1b1f2326;
} \ No newline at end of file
diff --git a/webui/src/pages/list/ListQuery.tsx b/webui/src/pages/list/ListQuery.tsx
index b135827f..099adcd8 100644
--- a/webui/src/pages/list/ListQuery.tsx
+++ b/webui/src/pages/list/ListQuery.tsx
@@ -11,6 +11,8 @@ import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';
import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
import Skeleton from '@material-ui/lab/Skeleton';
+import GBButton from 'src/components/Button/GBButton';
+
import FilterToolbar from './FilterToolbar';
import List from './List';
import { useListBugsQuery } from './ListQuery.generated';
@@ -291,9 +293,7 @@ function ListQuery() {
</button>
</form>
</div>
- <Link to="/newIssue" className="bt-new-issue">
- New Issue
- </Link>
+ <GBButton to="/new" text="New Issue" />
</header>
<FilterToolbar query={query} queryLocation={queryLocation} />
{content}
diff --git a/webui/src/pages/new/NewPage.tsx b/webui/src/pages/new/NewPage.tsx
new file mode 100644
index 00000000..b485987e
--- /dev/null
+++ b/webui/src/pages/new/NewPage.tsx
@@ -0,0 +1,80 @@
+import { gql, useMutation } from '@apollo/client';
+import React, { FormEvent } from 'react';
+
+import Paper from '@material-ui/core/Paper/Paper';
+import TextField from '@material-ui/core/TextField/TextField';
+import { fade, makeStyles, Theme } from '@material-ui/core/styles';
+
+import GBButton from '../../components/Button/GBButton';
+
+/**
+ * Styles
+ */
+const useStyles = makeStyles((theme) => ({
+ main: {
+ maxWidth: 800,
+ margin: 'auto',
+ marginTop: theme.spacing(4),
+ marginBottom: theme.spacing(4),
+ padding: theme.spacing(2),
+ overflow: 'hidden',
+ },
+ titleInput: {
+ borderRadius: theme.shape.borderRadius,
+ borderColor: fade(theme.palette.primary.main, 0.2),
+ borderStyle: 'solid',
+ borderWidth: '1px',
+ backgroundColor: fade(theme.palette.primary.main, 0.05),
+ padding: theme.spacing(0, 0),
+ transition: theme.transitions.create([
+ 'width',
+ 'borderColor',
+ 'backgroundColor',
+ ]),
+ },
+ form: {
+ display: 'flex',
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ justifyContent: 'flex-end',
+ },
+}));
+
+const NEW_BUG = gql`
+ mutation NewBug($input: NewBugInput) {
+ newBug(input: $input) {
+ title
+ message
+ }
+ }
+`;
+
+/**
+ * Form to create a new issue
+ */
+function NewPage() {
+ const classes = useStyles({ searching: false });
+ const [newBugInput] = useMutation(NEW_BUG);
+
+ function submitNewIssue(e: FormEvent) {
+ e.preventDefault();
+ // TODO Call API
+ }
+
+ return (
+ <Paper className={classes.main}>
+ <form className={classes.form} onSubmit={submitNewIssue}>
+ <TextField
+ label="Title"
+ className={classes.titleInput}
+ variant="outlined"
+ fullWidth
+ margin="dense"
+ />
+ <GBButton to="/" text="Submit new issue" />
+ </form>
+ </Paper>
+ );
+}
+
+export default NewPage;