2020-01-16 00:35:39 +01:00
|
|
|
import React, { useState, useCallback } from 'react'
|
2020-01-12 18:34:51 +01:00
|
|
|
|
|
|
|
import Link from '../components/link'
|
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
const HomeLink = () => (
|
|
|
|
<div className="home">
|
|
|
|
<Link href="/">
|
|
|
|
<div>fantus</div>
|
2020-01-16 00:35:39 +01:00
|
|
|
</Link>
|
2021-01-02 00:21:29 +01:00
|
|
|
</div>
|
|
|
|
)
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2020-01-12 18:34:51 +01:00
|
|
|
const Menu: React.FC = () => {
|
2021-01-02 00:21:29 +01:00
|
|
|
const [open, setOpen] = useState(false)
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
const _close = useCallback(() => {
|
|
|
|
setOpen(false)
|
|
|
|
}, [])
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
const _toggle = useCallback(() => {
|
|
|
|
setOpen(!open)
|
|
|
|
}, [open])
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
return (
|
|
|
|
<nav className="main flex justify-between items-center">
|
|
|
|
<HomeLink />
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
<img id="icon" src="/assets/menu.svg" onClick={_toggle} />
|
2020-01-16 00:35:39 +01:00
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
<div className={`links flex ${open ? 'open' : ''}`.trim()} onClick={_close}>
|
|
|
|
<HomeLink />
|
|
|
|
<Link href="/works">
|
|
|
|
<div>works</div>
|
|
|
|
</Link>
|
|
|
|
<Link href="/sets">
|
|
|
|
<div>sets</div>
|
|
|
|
</Link>
|
|
|
|
<Link href="/mastering">
|
|
|
|
<div>mastering</div>
|
|
|
|
</Link>
|
|
|
|
<Link href="/about">
|
|
|
|
<div>about</div>
|
|
|
|
</Link>
|
|
|
|
</div>
|
2020-01-12 18:34:51 +01:00
|
|
|
</nav>
|
2021-01-02 00:21:29 +01:00
|
|
|
)
|
2020-01-12 18:34:51 +01:00
|
|
|
}
|
|
|
|
|
2021-01-02 00:21:29 +01:00
|
|
|
export default Menu
|