-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
213 lines (204 loc) · 7.67 KB
/
index.tsx
File metadata and controls
213 lines (204 loc) · 7.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
'use client';
import React, { useState, useCallback } from 'react';
import Link from 'next/link';
import Image from 'next/image';
import { usePathname } from 'next/navigation';
export const Navbar = React.memo(() => {
const pathname = usePathname();
const [isMenuOpen, setIsMenuOpen] = useState(false);
const isActive = useCallback((path: string) => {
return pathname === path;
}, [pathname]);
const toggleMenu = useCallback(() => {
setIsMenuOpen(prev => !prev);
}, []);
const closeMenu = useCallback(() => {
setIsMenuOpen(false);
}, []);
return (
<nav className="bg-white shadow-lg">
<div className="max-w-7xl mx-auto px-4">
<div className="flex justify-between h-16">
<div className="flex">
<Link href="/" className="flex-shrink-0 flex items-center">
<Image
src="/images/logo.png"
alt="HelpDev Logo"
width={120}
height={40}
className="h-8 w-auto"
priority
/>
</Link>
{/* Desktop Menu */}
<div className="hidden sm:ml-6 sm:flex sm:space-x-8">
<Link
href="/articles"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${
isActive('/articles')
? 'border-blue-500 text-gray-900'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Artigos
</Link>
<Link
href="/services"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${
isActive('/services')
? 'border-blue-500 text-gray-900'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Serviços
</Link>
<Link
href="/projects"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${
isActive('/projects')
? 'border-blue-500 text-gray-900'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Projetos
</Link>
<Link
href="/blog"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${
isActive('/blog')
? 'border-blue-500 text-gray-900'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Blog/Gists
</Link>
<Link
href="/about"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${
isActive('/about')
? 'border-blue-500 text-gray-900'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Sobre
</Link>
<Link
href="/#contato"
className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700`}
>
Contato
</Link>
</div>
</div>
{/* Mobile menu button */}
<div className="flex items-center sm:hidden">
<button
onClick={toggleMenu}
className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500"
>
<span className="sr-only">Abrir menu principal</span>
{/* Icon when menu is closed */}
<svg
className={`${isMenuOpen ? 'hidden' : 'block'} h-6 w-6`}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M4 6h16M4 12h16M4 18h16"
/>
</svg>
{/* Icon when menu is open */}
<svg
className={`${isMenuOpen ? 'block' : 'hidden'} h-6 w-6`}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>
</div>
</div>
{/* Mobile menu */}
<div className={`${isMenuOpen ? 'block' : 'hidden'} sm:hidden`}>
<div className="pt-2 pb-3 space-y-1">
<Link
href="/articles"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium ${
isActive('/articles')
? 'border-blue-500 text-blue-700 bg-blue-50'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700'
}`}
onClick={closeMenu}
>
Artigos
</Link>
<Link
href="/services"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium ${
isActive('/services')
? 'border-blue-500 text-blue-700 bg-blue-50'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700'
}`}
onClick={closeMenu}
>
Serviços
</Link>
<Link
href="/projects"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium ${
isActive('/projects')
? 'border-blue-500 text-blue-700 bg-blue-50'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700'
}`}
onClick={closeMenu}
>
Projetos
</Link>
<Link
href="/blog"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium ${
isActive('/blog')
? 'border-blue-500 text-blue-700 bg-blue-50'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700'
}`}
onClick={closeMenu}
>
Blog/Gists
</Link>
<Link
href="/about"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium ${
isActive('/about')
? 'border-blue-500 text-blue-700 bg-blue-50'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700'
}`}
onClick={closeMenu}
>
Sobre
</Link>
<Link
href="/#contato"
className={`block pl-3 pr-4 py-2 border-l-4 text-base font-medium border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700`}
onClick={closeMenu}
>
Contato
</Link>
</div>
</div>
</nav>
);
});
Navbar.displayName = 'Navbar';