2020-07-14 14:52:25 +00:00
|
|
|
import React from "react"
|
2020-07-13 12:02:40 +00:00
|
|
|
import classnames from "classnames"
|
|
|
|
import * as routes from "@config/routes"
|
2020-07-14 12:38:07 +00:00
|
|
|
import useSmoothScroll from "@libs/useSmoothScroll"
|
2020-07-13 12:02:40 +00:00
|
|
|
import logo from "@images/logo.svg"
|
2020-07-14 12:38:07 +00:00
|
|
|
import { HEADER_ID } from "@features/HomePage/components/Header"
|
|
|
|
import { SECTION_ID as PROJECTS_SECTION_ID } from "@features/HomePage/components/Projects/Projects"
|
|
|
|
import { SECTION_ID as CONTACT_SECTION_ID } from "@features/HomePage/components/Contact"
|
2020-07-13 12:02:40 +00:00
|
|
|
|
|
|
|
import { makeStyles } from "@material-ui/core/styles"
|
2020-07-14 14:52:25 +00:00
|
|
|
import { AppBar, Toolbar, Container, Link } from "@material-ui/core"
|
|
|
|
import { Link as GatsbyLink } from "gatsby-theme-material-ui"
|
2020-07-13 12:02:40 +00:00
|
|
|
|
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
appBar: {
|
|
|
|
backgroundColor: "transparent",
|
|
|
|
color: "#fff",
|
|
|
|
boxShadow: "none",
|
|
|
|
},
|
2020-07-14 14:52:25 +00:00
|
|
|
linkContainer: {
|
2020-07-13 12:02:40 +00:00
|
|
|
"& > *:not(:last-child)": {
|
|
|
|
marginRight: theme.spacing(1.5),
|
|
|
|
},
|
2020-07-14 14:52:25 +00:00
|
|
|
[theme.breakpoints.down("xs")]: {
|
|
|
|
"& > *:not(:last-child)": {
|
|
|
|
marginRight: theme.spacing(0.75),
|
|
|
|
},
|
|
|
|
},
|
2020-07-13 12:02:40 +00:00
|
|
|
},
|
|
|
|
logo: {
|
|
|
|
width: "56px",
|
|
|
|
height: "auto",
|
|
|
|
[theme.breakpoints.down("xs")]: {
|
|
|
|
width: "48px",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
divider: {
|
|
|
|
flexGrow: 1,
|
|
|
|
},
|
|
|
|
link: {
|
|
|
|
width: "100%",
|
|
|
|
},
|
|
|
|
titleContainer: {
|
|
|
|
display: "flex",
|
|
|
|
alignItems: "center",
|
|
|
|
"& > *:not(:last-child)": {
|
|
|
|
marginRight: theme.spacing(1),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
toolbar: {
|
|
|
|
padding: theme.spacing(2, 0),
|
|
|
|
fontSize: "1.25rem",
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2020-07-14 10:24:48 +00:00
|
|
|
function Navbar({ className, ...rest }) {
|
2020-07-13 12:02:40 +00:00
|
|
|
const classes = useStyles()
|
2021-01-10 19:13:45 +00:00
|
|
|
const handleClickLink = useSmoothScroll()
|
2020-07-13 12:02:40 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<AppBar
|
|
|
|
component="nav"
|
|
|
|
position="static"
|
|
|
|
{...rest}
|
|
|
|
className={classnames(classes.appBar, className)}
|
|
|
|
>
|
|
|
|
<Container>
|
|
|
|
<Toolbar className={classes.toolbar} disableGutters>
|
|
|
|
<div className={classes.titleContainer}>
|
2020-07-14 12:38:07 +00:00
|
|
|
<GatsbyLink title="Strona główna" color="inherit" to={routes.HOME}>
|
2020-07-13 12:02:40 +00:00
|
|
|
<img className={classes.logo} src={logo} alt="logo" />
|
2020-07-14 12:38:07 +00:00
|
|
|
</GatsbyLink>
|
2020-07-13 12:02:40 +00:00
|
|
|
</div>
|
|
|
|
<div className={classes.divider} />
|
2020-07-14 14:52:25 +00:00
|
|
|
<div className={classes.linkContainer}>
|
|
|
|
<Link
|
|
|
|
title="Start"
|
|
|
|
color="inherit"
|
|
|
|
href={"#" + HEADER_ID}
|
2021-01-10 19:13:45 +00:00
|
|
|
onClick={handleClickLink(HEADER_ID)}
|
2020-07-14 14:52:25 +00:00
|
|
|
>
|
|
|
|
Start
|
|
|
|
</Link>
|
|
|
|
<Link
|
|
|
|
title="Projekty"
|
|
|
|
color="inherit"
|
|
|
|
href={"#" + PROJECTS_SECTION_ID}
|
2021-01-10 19:13:45 +00:00
|
|
|
onClick={handleClickLink(PROJECTS_SECTION_ID)}
|
2020-07-14 14:52:25 +00:00
|
|
|
>
|
|
|
|
Projekty
|
|
|
|
</Link>
|
|
|
|
<Link
|
|
|
|
title="Kontakt"
|
|
|
|
color="inherit"
|
|
|
|
href={"#" + CONTACT_SECTION_ID}
|
2021-01-10 19:13:45 +00:00
|
|
|
onClick={handleClickLink(CONTACT_SECTION_ID)}
|
2020-07-14 14:52:25 +00:00
|
|
|
>
|
|
|
|
Kontakt
|
|
|
|
</Link>
|
2020-07-13 12:02:40 +00:00
|
|
|
</div>
|
|
|
|
</Toolbar>
|
|
|
|
</Container>
|
|
|
|
</AppBar>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-07-14 10:24:48 +00:00
|
|
|
export default Navbar
|