mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 21:27:20 +01:00
20 lines
627 B
TypeScript
20 lines
627 B
TypeScript
import { Button, Icon } from '@umami/react-zen';
|
|
import { useState } from 'react';
|
|
import { Close, Menu } from '@/components/icons';
|
|
import { MobileMenu } from './MobileMenu';
|
|
|
|
export function HamburgerButton({ menuItems }: { menuItems: any[] }) {
|
|
const [active, setActive] = useState(false);
|
|
|
|
const handleClick = () => setActive(state => !state);
|
|
const handleClose = () => setActive(false);
|
|
|
|
return (
|
|
<>
|
|
<Button variant="quiet" onClick={handleClick}>
|
|
<Icon>{active ? <Close /> : <Menu />}</Icon>
|
|
</Button>
|
|
{active && <MobileMenu items={menuItems} onClose={handleClose} />}
|
|
</>
|
|
);
|
|
}
|