Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit d9ee3a7

Browse files
Orlundo Hubbardwith-heart
authored andcommitted
responsive navbar
1 parent 0f1a8a5 commit d9ee3a7

File tree

1 file changed

+125
-54
lines changed

1 file changed

+125
-54
lines changed

frontend/src/components/Nav/index.tsx

Lines changed: 125 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,137 @@
11
import React from 'react';
2-
import { chakra, Flex, HStack } from '@chakra-ui/react';
2+
3+
import {
4+
chakra,
5+
Box,
6+
Flex,
7+
useColorModeValue,
8+
HStack,
9+
useDisclosure,
10+
VStack,
11+
IconButton,
12+
CloseButton,
13+
} from '@chakra-ui/react';
14+
import { AiOutlineMenu } from 'react-icons/ai';
15+
import Logo from '../Logo';
16+
import { IconGitHub } from '../Icons';
317
import Link from 'next/link';
418
import { useTranslation } from 'react-i18next';
5-
import { IconGitHub } from '../Icons';
6-
import Logo from '../Logo';
719

8-
function Nav() {
20+
export default function Gslr() {
21+
const bg = useColorModeValue('white', 'gray.800');
22+
const mobileNav = useDisclosure();
923
const { t } = useTranslation();
1024

1125
return (
12-
<chakra.nav borderBottom="1px solid" borderColor="gray.200">
13-
<Flex
14-
justify="space-between"
15-
align="center"
16-
mx="auto"
17-
maxW="7xl"
18-
minW="xl"
19-
py={3}
20-
px={5}
26+
<React.Fragment>
27+
<chakra.header
28+
bg={bg}
29+
w="full"
30+
px={{ base: 2, sm: 4 }}
31+
py={4}
32+
shadow="md"
2133
>
22-
<Link href="/" passHref>
23-
<HStack as="a" title={t('title')} display="flex" alignItems="center">
24-
<Logo h={7} w={7} />
25-
<chakra.span
26-
fontWeight="bold"
27-
fontSize="sm"
28-
color="gray.600"
29-
transition="color 300ms ease-in-out"
30-
_hover={{ color: 'black' }}
34+
<Flex alignItems="center" justifyContent="space-between" mx="auto">
35+
<Flex>
36+
<chakra.a
37+
href="/"
38+
title="Choc Home Page"
39+
display="flex"
40+
alignItems="center"
41+
>
42+
<Logo h={7} w={7} />
43+
</chakra.a>
44+
<chakra.h1 fontSize="m" fontWeight="medium" ml="2">
45+
Developer DAO
46+
</chakra.h1>
47+
</Flex>
48+
<HStack display="flex" alignItems="center" spacing={1}>
49+
<HStack
50+
spacing={5}
51+
mr={1}
52+
color="brand.500"
53+
display={{ base: 'none', md: 'inline-flex' }}
3154
>
32-
{t('title')}
33-
</chakra.span>
55+
<Link href="/" passHref>
56+
{t('home')}
57+
</Link>
58+
<Link href="/mint" passHref>
59+
{t('mintTokenText')}
60+
</Link>
61+
<Link href="/projects" passHref>
62+
{t('projects')}
63+
</Link>
64+
<IconGitHub
65+
h={7}
66+
w={7}
67+
opacity={0.6}
68+
transition="opacity 300ms ease-in-out"
69+
_hover={{ opacity: 1 }}
70+
/>
71+
</HStack>
72+
73+
<Box display={{ base: 'inline-flex', md: 'none' }}>
74+
<IconButton
75+
display={{ base: 'flex', md: 'none' }}
76+
aria-label="Open menu"
77+
fontSize="20px"
78+
color={useColorModeValue('grey.800', 'inherit')}
79+
variant="ghost"
80+
icon={<AiOutlineMenu />}
81+
onClick={mobileNav.onOpen}
82+
/>
83+
84+
<VStack
85+
pos="absolute"
86+
top={2}
87+
left={0}
88+
right={0}
89+
display={mobileNav.isOpen ? 'flex' : 'none'}
90+
flexDirection="column"
91+
pt={7}
92+
pb={7}
93+
m={0}
94+
bg={bg}
95+
spacing={3}
96+
rounded="sm"
97+
shadow="sm"
98+
>
99+
<CloseButton
100+
aria-label="Close menu"
101+
onClick={mobileNav.onClose}
102+
/>
103+
104+
<Link href="/" passHref>
105+
{t('home')}
106+
</Link>
107+
108+
<Link href="/mint" passHref>
109+
{t('mintTokenText')}
110+
</Link>
111+
112+
<Link href="/projects" passHref>
113+
{t('projects')}
114+
</Link>
115+
116+
<chakra.a
117+
href="https://github.com/Developer-DAO/developer-dao"
118+
target="_blank"
119+
rel="noreferrer"
120+
title={t('daoGithubRepo')}
121+
>
122+
<IconGitHub
123+
h={7}
124+
w={7}
125+
opacity={0.6}
126+
transition="opacity 300ms ease-in-out"
127+
_hover={{ opacity: 1 }}
128+
/>
129+
</chakra.a>
130+
</VStack>
131+
</Box>
34132
</HStack>
35-
</Link>
36-
<HStack spacing={{ base: 3, sm: 10 }}>
37-
<Link href="/" passHref>
38-
{t('home')}
39-
</Link>
40-
<Link href="/mint" passHref>
41-
{t('mintTokenText')}
42-
</Link>
43-
<Link href="/projects" passHref>
44-
{t('projects')}
45-
</Link>
46-
<chakra.a
47-
href="https://github.com/Developer-DAO/developer-dao"
48-
target="_blank"
49-
rel="noreferrer"
50-
title={t('daoGithubRepo')}
51-
>
52-
<IconGitHub
53-
h={7}
54-
w={7}
55-
opacity={0.6}
56-
transition="opacity 300ms ease-in-out"
57-
_hover={{ opacity: 1 }}
58-
/>
59-
</chakra.a>
60-
</HStack>
61-
</Flex>
62-
</chakra.nav>
133+
</Flex>
134+
</chakra.header>
135+
</React.Fragment>
63136
);
64137
}
65-
66-
export default Nav;

0 commit comments

Comments
 (0)