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