|
1 | 1 | import { useDB } from '@/context/DBContext' |
2 | 2 | import { signOut } from 'firebase/auth' |
3 | 3 | import { Link, useLocation } from 'react-router' |
| 4 | +import React from 'react' |
| 5 | +import { LucideBarChart3, LucideExternalLink, LucideMap, LucideUser } from 'lucide-react' |
4 | 6 |
|
5 | 7 | const Navigation = () => { |
6 | 8 | const { isLoggedIn, auth } = useDB() |
7 | 9 | 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} |
10 | 28 | {text} |
11 | 29 | </Link> |
12 | 30 | ) |
13 | 31 | 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} />} /> |
17 | 38 | {isLoggedIn && ( |
18 | 39 | <> |
19 | | - <div className="h-3 border-l-2 border-gray-400" /> |
| 40 | + <div className="mx-3 h-3 border-l-2 border-gray-400" /> |
20 | 41 | <NavLink to="/admin/dash" text="Administrar categorías" /> |
21 | 42 | <NavLink to="/admin/publish" text="Publicar Datos" /> |
22 | 43 | <NavLink to="/admin/analytics" text="Analítica web" /> |
23 | 44 | </> |
24 | 45 | )} |
25 | 46 | <div className="flex-grow" /> |
| 47 | + <ExternalLink href="https://redcoralmap.org/guia-metodologia" text="Guía de Metodología" /> |
26 | 48 | {isLoggedIn ? ( |
27 | 49 | <> |
28 | 50 | <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 */} |
30 | 57 | Salir |
31 | 58 | </button> |
32 | 59 | </> |
33 | 60 | ) : ( |
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 | + </> |
36 | 64 | )} |
37 | 65 | </div> |
38 | 66 | ) |
|
0 commit comments