aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-27 19:48:22 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-28 00:13:30 +0300
commit8f0a5024a2b062c7ddf8d73f909b39050a624888 (patch)
tree2070ca489d76ab136bfb72b32c1e3d47f4efd57d /src/lib/components
parentf4d827289e54ac66d1b0033cb3b6a27d920adaab (diff)
downloadreact-benzin-8f0a5024a2b062c7ddf8d73f909b39050a624888.tar.gz
feat: make Header more abstract
Diffstat (limited to 'src/lib/components')
-rw-r--r--src/lib/components/Header/Header.js28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/lib/components/Header/Header.js b/src/lib/components/Header/Header.js
index fddf8b3..a055fcb 100644
--- a/src/lib/components/Header/Header.js
+++ b/src/lib/components/Header/Header.js
@@ -9,20 +9,16 @@ import {
} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
-import TimerIcon from '@material-ui/icons/Timer';
-import AccountCircleIcon from '@material-ui/icons/AccountCircle';
-import AssignmentIcon from '@material-ui/icons/Assignment';
-import GitHubIcon from '@material-ui/icons/GitHub';
const useStyles = makeStyles(theme => ({
root: {
background: theme.palette.background.elevation2,
color: theme.palette.text.primary,
+ paddingLeft: theme.spacing(3),
},
logo: {
- margin: theme.spacing(0, 3, 0, 3),
- color: theme.palette.primary.main,
+ margin: theme.spacing(0, 3, 0, 1),
},
tab: {
'& .MuiTab-wrapper': {
@@ -37,31 +33,25 @@ const useStyles = makeStyles(theme => ({
}));
-const Header = ({ page, setPage }) => {
+const Header = ({ logo, contents, page, setPage }) => {
const classes = useStyles();
const handleChange = (event, newPage) => {
setPage(newPage);
};
- const icons = {
- app: (<TimerIcon />),
- profile: (<AccountCircleIcon />),
- scoreboard: (<AssignmentIcon />),
- contribute: (<GitHubIcon />),
- };
-
return (
<AppBar position="sticky" className={classes.root}>
<Toolbar>
- <Typography variant="h4" className={classes.logo}>
- ChronoCube
- </Typography>
+ {logo.icon}
+ <Typography variant="h4" className={classes.logo} color="primary">
+ {logo.title}
+ </Typography>
<Tabs onChange={handleChange} value={page}>
- { Object.keys(icons).map(item => (
+ {contents && Object.keys(contents).map(item => (
<Tab
label={item}
- icon={icons[item]}
+ icon={contents[item]}
value={item}
className={classes.tab}
key={item}