import { useState } from 'react'; import { solid } from '@fortawesome/fontawesome-svg-core/import.macro'; // <-- import styles to be used import { ActionIcon, Burger, Container, Drawer, Flex, Group, Header, MediaQuery, Stack, useMantineColorScheme, } from '@mantine/core'; import { useLocation } from 'react-router-dom'; import { NavLinkProps } from '@/configs/links'; import { isRouteActive } from '@/shared/helpers'; import Brand from '../Brand/Brand'; import Icon from '../Icon'; import NavbarLink from './NavbarLink'; export interface ShellHeaderProps { height: number; links: NavLinkProps[]; } const ShellHeader: React.FC = ({ height, links }) => { const { pathname } = useLocation(); const [isDrawerOpen, setIsDrawerOpen] = useState(false); const { colorScheme, toggleColorScheme } = useMantineColorScheme(); return (
setIsDrawerOpen((o) => !o)} size="sm" title={isDrawerOpen ? 'Close navigation' : 'Open navigation'} /> {links.map((item) => { return ( ({ ...el, isActive: isRouteActive(pathname, el.href), }))} isActive={isRouteActive(pathname, item.href)} /> ); })} toggleColorScheme()} title="Toggle color scheme" > {colorScheme === 'dark' ? ( ) : ( )} setIsDrawerOpen(false)} title="Navigation" padding="xl" size="md" > {links.map((item) => { return ( ({ ...el, isActive: isRouteActive(pathname, el.href), }))} isActive={isRouteActive(pathname, item.href)} /> ); })}
); }; export default ShellHeader;