65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
'use client'
|
|
|
|
import { MoonIcon, SunIcon } from '@chakra-ui/icons'
|
|
import { Box, Button, Flex, Heading, Link, Spacer, Stack, useColorMode, useColorModeValue } from '~/app/ui'
|
|
|
|
export default function Header({ siteName }) {
|
|
const { colorMode, toggleColorMode } = useColorMode()
|
|
return (
|
|
<>
|
|
<Box bg={useColorModeValue('gray.100', 'gray.900')} px={4}>
|
|
<Flex h={16} alignItems={'center'}>
|
|
<Heading size="md">{siteName}</Heading>
|
|
|
|
<MainMenu />
|
|
<Spacer />
|
|
|
|
<Flex alignItems={'center'}>
|
|
<Stack direction={'row'} spacing={7}>
|
|
<Button onClick={toggleColorMode}>{colorMode === 'light' ? <MoonIcon /> : <SunIcon />}</Button>
|
|
</Stack>
|
|
</Flex>
|
|
</Flex>
|
|
</Box>
|
|
</>
|
|
)
|
|
}
|
|
|
|
const MainMenu = () => {
|
|
const linkColor = useColorModeValue('gray.600', 'gray.200')
|
|
const linkHoverColor = useColorModeValue('gray.800', 'white')
|
|
|
|
return (
|
|
<Stack direction={'row'} spacing={4} pl="4">
|
|
{NAV_ITEMS.map((navItem) => (
|
|
<Box key={navItem.label}>
|
|
<Link
|
|
p={2}
|
|
href={navItem.href ?? '#'}
|
|
fontSize={'sm'}
|
|
fontWeight={500}
|
|
color={linkColor}
|
|
_hover={{
|
|
textDecoration: 'none',
|
|
color: linkHoverColor,
|
|
}}
|
|
>
|
|
{navItem.label}
|
|
</Link>
|
|
</Box>
|
|
))}
|
|
</Stack>
|
|
)
|
|
}
|
|
|
|
const NAV_ITEMS = [
|
|
{
|
|
label: 'Vendors',
|
|
href: '/vendors',
|
|
},
|
|
{
|
|
label: 'About Us',
|
|
href: '/about-us',
|
|
},
|
|
]
|