summaryrefslogtreecommitdiffstatshomepage
path: root/webui/src/components/Header/Header.tsx
blob: 69b3fdfb2f9fad93e9b6d2b1132e347432c96963 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import AppBar from '@mui/material/AppBar';
import Toolbar from '@mui/material/Toolbar';
import { alpha } from '@mui/material/styles';
import makeStyles from '@mui/styles/makeStyles';
import { Link } from 'react-router';

import CurrentIdentity from '../Identity/CurrentIdentity';
import CurrentRepository from '../Identity/CurrentRepository';
import { LightSwitch } from '../Themer';

const useStyles = makeStyles((theme) => ({
  offset: {
    ...theme.mixins.toolbar,
  },
  filler: {
    flexGrow: 1,
  },
  appBar: {
    backgroundColor: theme.palette.primary.dark,
    color: theme.palette.primary.contrastText,
  },
  appTitle: {
    ...theme.typography.h6,
    color: theme.palette.primary.contrastText,
    textDecoration: 'none',
    display: 'flex',
    alignItems: 'center',
  },
  lightSwitch: {
    marginRight: theme.spacing(2),
    color: alpha(theme.palette.primary.contrastText, 0.5),
  },
  logo: {
    height: '42px',
    marginRight: theme.spacing(2),
  },
}));

function Header() {
  const classes = useStyles();

  return (
    <>
      <AppBar position="fixed" className={classes.appBar}>
        <Toolbar>
          <Link to="/" className={classes.appTitle}>
            <img src="/logo.svg" className={classes.logo} alt="git-bug logo" />
            <CurrentRepository default="git-bug" />
          </Link>
          <div className={classes.filler} />
          <LightSwitch className={classes.lightSwitch} />
          <CurrentIdentity />
        </Toolbar>
      </AppBar>
      <div className={classes.offset}></div>
    </>
  );
}

export default Header;