1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-24 03:23:08 +01:00
developer-roadmap/components/global-header.tsx

99 lines
2.8 KiB
TypeScript
Raw Normal View History

2021-08-28 12:48:48 +02:00
import {
Box,
Container,
Flex,
IconButton,
Image,
Link,
Menu,
MenuButton, MenuItem,
MenuList,
Stack,
Text
} from '@chakra-ui/react';
import { HamburgerIcon } from '@chakra-ui/icons';
type MenuLinkProps = {
text: string;
link: string;
};
function MenuLink(props: MenuLinkProps) {
const { text, link } = props;
return <Link
borderBottomWidth={0}
borderBottomColor='gray.500'
_hover={{ textDecoration: 'none', borderBottomColor: 'white' }}
fontWeight={500}
href={link}
>
{text}
</Link>;
}
function DesktopMenuLinks() {
return (
<Stack d={['none', 'flex', 'flex']} shouldWrapChildren isInline spacing='15px' alignItems='center' color='gray.50'
fontSize='15px'>
<MenuLink text={'Roadmaps'} link={'/roadmaps'} />
<MenuLink text={'Guides'} link={'/guides'} />
<MenuLink text={'Videos'} link={'/watch'} />
<Link ml='10px' bgGradient='linear(to-l, yellow.700, red.600)' p='7px 10px' rounded='4px'
_hover={{ textDecoration: 'none', bgGradient: 'linear(to-l, red.800, yellow.700)' }}
fontWeight={500} href={'#'}>Subscribe</Link>
</Stack>
);
}
function MobileMenuLinks() {
return (
2021-08-28 13:38:29 +02:00
<Menu autoSelect={false}>
2021-08-28 12:48:48 +02:00
<MenuButton
d={['block', 'none', 'none']}
as={HamburgerIcon}
aria-label='Options'
variant='outline'
color='white' w='22px' height='22px'
cursor='pointer'
/>
<MenuList py={'4px'} rounded='3px' minWidth='150px'>
2021-08-28 13:38:29 +02:00
<MenuItem py='4px' borderColor='gray.100' borderBottomWidth={1} fontSize='13px'
color='gray.600'>Roadmaps</MenuItem>
<MenuItem py='4px' borderColor='gray.100' borderBottomWidth={1} fontSize='13px'
color='gray.600'>Guides</MenuItem>
<MenuItem py='4px' borderColor='gray.100' borderBottomWidth={1} fontSize='13px'
color='gray.600'>Videos</MenuItem>
2021-08-28 12:48:48 +02:00
<MenuItem py='4px' borderColor='gray.100' fontSize='13px' color='gray.600'>Subscribe</MenuItem>
</MenuList>
</Menu>
);
}
2021-08-14 14:01:42 +02:00
2021-08-20 17:06:26 +02:00
export function GlobalHeader() {
2021-08-14 14:01:42 +02:00
return (
2021-08-28 12:48:48 +02:00
<Box bg='gray.900' p='20px 0'>
2021-08-14 14:01:42 +02:00
<Container maxW='container.md'>
2021-08-28 12:48:48 +02:00
<Flex justifyContent='space-between' alignItems='center'>
2021-08-28 13:38:29 +02:00
<Box>
<Link w='100%'
d='flex'
href='/'
alignItems='center'
color='white'
fontWeight={600}
_hover={{ textDecoration: 'none' }}
fontSize='18px'>
<Image h='30px' w='30px' src='/logo.svg' mr='10px' />
<Text d={['none', 'none', 'block']} as='span'>roadmap.sh</Text>
</Link>
</Box>
2021-08-28 12:48:48 +02:00
<DesktopMenuLinks />
<MobileMenuLinks />
2021-08-14 14:01:42 +02:00
</Flex>
</Container>
</Box>
);
}