2022-12-27 00:57:59 +00:00
|
|
|
import { Button, Icon } from 'react-basics';
|
2022-03-01 02:39:37 +00:00
|
|
|
import { useState } from 'react';
|
2023-01-31 05:44:07 +00:00
|
|
|
import MobileMenu from './MobileMenu';
|
|
|
|
|
import Icons from 'components/icons';
|
2022-03-01 02:39:37 +00:00
|
|
|
|
2023-10-30 22:18:48 +00:00
|
|
|
export function HamburgerButton({ menuItems }) {
|
2022-03-01 02:39:37 +00:00
|
|
|
const [active, setActive] = useState(false);
|
|
|
|
|
|
2023-04-10 03:22:28 +00:00
|
|
|
const handleClick = () => setActive(state => !state);
|
|
|
|
|
const handleClose = () => setActive(false);
|
2022-03-01 02:39:37 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2023-04-10 03:22:28 +00:00
|
|
|
<Button variant="quiet" onClick={handleClick}>
|
2023-01-31 05:44:07 +00:00
|
|
|
<Icon>{active ? <Icons.Close /> : <Icons.Menu />}</Icon>
|
2022-12-27 00:57:59 +00:00
|
|
|
</Button>
|
2022-03-01 02:39:37 +00:00
|
|
|
{active && <MobileMenu items={menuItems} onClose={handleClose} />}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-04-21 15:00:42 +00:00
|
|
|
|
|
|
|
|
export default HamburgerButton;
|