App.tsx

 1import AppBar from '@material-ui/core/AppBar';
 2import CssBaseline from '@material-ui/core/CssBaseline';
 3import Toolbar from '@material-ui/core/Toolbar';
 4import {
 5  createMuiTheme,
 6  ThemeProvider,
 7  makeStyles,
 8} from '@material-ui/core/styles';
 9import React from 'react';
10import { Route, Switch } from 'react-router';
11import { Link } from 'react-router-dom';
12
13import CurrentIdentity from './CurrentIdentity';
14import BugQuery from './bug/BugQuery';
15import ListQuery from './list/ListQuery';
16
17const theme = createMuiTheme({
18  palette: {
19    primary: {
20      main: '#263238',
21    },
22  },
23});
24
25const useStyles = makeStyles(theme => ({
26  offset: {
27    ...theme.mixins.toolbar,
28  },
29  filler: {
30    flexGrow: 1,
31  },
32  appTitle: {
33    ...theme.typography.h6,
34    color: 'white',
35    textDecoration: 'none',
36    display: 'flex',
37    alignItems: 'center',
38  },
39  logo: {
40    height: '42px',
41    marginRight: theme.spacing(2),
42  },
43}));
44
45export default function App() {
46  const classes = useStyles();
47
48  return (
49    <ThemeProvider theme={theme}>
50      <CssBaseline />
51      <AppBar position="fixed" color="primary">
52        <Toolbar>
53          <Link to="/" className={classes.appTitle}>
54            <img src="/logo.svg" className={classes.logo} alt="git-bug" />
55            git-bug
56          </Link>
57          <div className={classes.filler}></div>
58          <CurrentIdentity />
59        </Toolbar>
60      </AppBar>
61      <div className={classes.offset} />
62      <Switch>
63        <Route path="/" exact component={ListQuery} />
64        <Route path="/bug/:id" exact component={BugQuery} />
65      </Switch>
66    </ThemeProvider>
67  );
68}