Skip to content

Commit a2656e6

Browse files
committed
Redesign navbar
1 parent 2d099dc commit a2656e6

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

public/wordmark.png

50.7 KB
Loading

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const PublishAdmin = lazy(() => import('@/pages/PublishAdmin'))
1414

1515
function Layout() {
1616
return (
17-
<div className="relative h-screen max-h-screen pt-5">
17+
<div className="relative h-screen max-h-screen pt-12">
1818
<Navigation />
1919
<Outlet />
2020
<DBLoadingOverlay />
@@ -73,9 +73,9 @@ const App: React.FC = () => {
7373
return (
7474
<Router>
7575
<Routes>
76-
<Route path="/login" element={<LoginPage />} />
7776
<Route path="/" element={<Layout />}>
7877
<Route path="/" element={<Map />} />
78+
<Route path="/login" element={<LoginPage />} />
7979
<Route path="/stats" element={<StatsPage />} />
8080
<Route path="/about" element={<AdminAbout />} />
8181
<Route path="/admin" element={<Navigate to="/login" />} />

src/components/Navigation.tsx

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,66 @@
11
import { useDB } from '@/context/DBContext'
22
import { signOut } from 'firebase/auth'
33
import { Link, useLocation } from 'react-router'
4+
import React from 'react'
5+
import { LucideBarChart3, LucideExternalLink, LucideMap, LucideUser } from 'lucide-react'
46

57
const Navigation = () => {
68
const { isLoggedIn, auth } = useDB()
79
const { pathname } = useLocation()
8-
const NavLink = ({ to, text }: { to: string; text: string }) => (
9-
<Link to={to} className={`px-2 py-1 hover:bg-black/10 ${pathname === to && 'font-bold'}`}>
10+
const ExternalLink = ({ href, text }: { href: string; text: string }) => (
11+
<a
12+
href={href}
13+
target="_blank"
14+
rel="noopener noreferrer"
15+
className="flex items-center gap-1 rounded-full border px-3 py-1.5 text-black/80 transition hover:border-gray-400 hover:bg-gray-200 hover:text-black"
16+
>
17+
{text}
18+
<LucideExternalLink height={12} width={12} />
19+
</a>
20+
)
21+
22+
const NavLink = ({ to, icon, text }: { to: string; icon?: React.ReactNode; text: string }) => (
23+
<Link
24+
to={to}
25+
className={`flex items-center gap-1 rounded-full border px-3 py-1.5 transition ${pathname === to ? 'border-blue-600 bg-blue-100 text-blue-600 shadow-md' : 'text-black/80 hover:border-gray-400 hover:bg-gray-200 hover:text-black'}`}
26+
>
27+
{icon}
1028
{text}
1129
</Link>
1230
)
1331
return (
14-
<div className="absolute top-0 z-[1000] flex h-5 w-full items-center gap-1 overflow-x-auto overflow-y-hidden border-b-2 border-gray-400 bg-white px-2 text-xs leading-none">
15-
<NavLink to="/" text="Mapa" />
16-
<NavLink to="/stats" text="Estadísticas" />
32+
<div className="absolute top-0 z-[1000] flex h-12 w-full items-center gap-1 overflow-x-auto overflow-y-hidden border-b-2 border-gray-400 bg-white px-2 text-xs leading-none">
33+
<Link to="/">
34+
<img src="/wordmark.png" alt="Red Coral" className="h-6 w-auto pr-4" />
35+
</Link>
36+
<NavLink to="/" text="Mapa" icon={<LucideMap height={16} width={16} />} />
37+
<NavLink to="/stats" text="Estadísticas" icon={<LucideBarChart3 height={16} width={16} />} />
1738
{isLoggedIn && (
1839
<>
19-
<div className="h-3 border-l-2 border-gray-400" />
40+
<div className="mx-3 h-3 border-l-2 border-gray-400" />
2041
<NavLink to="/admin/dash" text="Administrar categorías" />
2142
<NavLink to="/admin/publish" text="Publicar Datos" />
2243
<NavLink to="/admin/analytics" text="Analítica web" />
2344
</>
2445
)}
2546
<div className="flex-grow" />
47+
<ExternalLink href="https://redcoralmap.org/guia-metodologia" text="Guía de Metodología" />
2648
{isLoggedIn ? (
2749
<>
2850
<NavLink to="/about" text="Acerca de" />
29-
<button onClick={() => signOut(auth)} className="inline px-2 py-1 hover:bg-black/10">
51+
<button
52+
onClick={() => signOut(auth)}
53+
className="flex items-center gap-1 rounded-full border px-3 py-1.5 text-black/80 transition hover:border-red-400 hover:bg-red-200 hover:text-red-600"
54+
>
55+
<LucideUser height={16} width={16} />
56+
{/* TODO: probably have a whole user menu here */}
3057
Salir
3158
</button>
3259
</>
3360
) : (
34-
// <NavLink to="/login" text="Registrarse" />
35-
<a href="https://redcoralmap.org/guia-metodologia">Guía de Metodología</a>
61+
<>
62+
<NavLink to="/login" text="Registrarse" icon={<LucideUser height={16} width={16} />} />
63+
</>
3664
)}
3765
</div>
3866
)

0 commit comments

Comments
 (0)