|
2 | 2 | import { useState } from 'react'; |
3 | 3 | import { Link, useLocation } from 'react-router-dom'; |
4 | 4 | import { Menu, X, Facebook, Instagram } from 'lucide-react'; |
| 5 | +import { useLanguage } from '@/contexts/LanguageContext'; |
| 6 | +import LanguageSwitcher from './LanguageSwitcher'; |
5 | 7 |
|
6 | 8 | const Navbar = () => { |
7 | 9 | const [isOpen, setIsOpen] = useState(false); |
8 | 10 | const location = useLocation(); |
| 11 | + const { t } = useLanguage(); |
9 | 12 |
|
10 | 13 | const navigation = [ |
11 | | - { name: 'Inicio', href: '/' }, |
12 | | - { name: 'Quiénes Somos', href: '/quienes-somos' }, |
13 | | - { name: 'Servicios', href: '/servicios' }, |
14 | | - { name: 'Ambientes', href: '/ambientes' }, |
15 | | - { name: 'Contacto', href: '/contacto' }, |
| 14 | + { name: t('nav.home'), href: '/' }, |
| 15 | + { name: t('nav.about'), href: '/quienes-somos' }, |
| 16 | + { name: t('nav.services'), href: '/servicios' }, |
| 17 | + { name: t('nav.environments'), href: '/ambientes' }, |
| 18 | + { name: t('nav.contact'), href: '/contacto' }, |
16 | 19 | ]; |
17 | 20 |
|
18 | 21 | const isActive = (path: string) => location.pathname === path; |
19 | 22 |
|
20 | 23 | return ( |
21 | | - <nav className="bg-white shadow-lg sticky top-0 z-50"> |
22 | | - <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
23 | | - <div className="flex justify-between h-20"> |
24 | | - {/* Logo */} |
25 | | - <div className="flex items-center"> |
26 | | - <Link to="/" className="flex items-center space-x-3"> |
27 | | - <img |
28 | | - src="/images/7763065a-89ed-4786-a8c7-998e28bbf032.webp" |
29 | | - alt="Dra. Liz Cheng" |
30 | | - className="h-20 w-auto" |
31 | | - /> |
32 | | - </Link> |
| 24 | + <> |
| 25 | + {/* Top Language Bar */} |
| 26 | + <div className="bg-dental-50 border-b border-dental-100"> |
| 27 | + <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
| 28 | + <div className="flex justify-end py-2"> |
| 29 | + <LanguageSwitcher /> |
33 | 30 | </div> |
| 31 | + </div> |
| 32 | + </div> |
34 | 33 |
|
35 | | - {/* Desktop Navigation */} |
36 | | - <div className="hidden md:flex items-center space-x-8"> |
37 | | - {navigation.map((item) => ( |
38 | | - <Link |
39 | | - key={item.name} |
40 | | - to={item.href} |
41 | | - className={`text-gray-700 hover:text-dental-600 px-3 py-2 text-sm font-medium transition-colors ${ |
42 | | - isActive(item.href) ? 'text-dental-600 border-b-2 border-dental-600' : '' |
43 | | - }`} |
44 | | - > |
45 | | - {item.name} |
| 34 | + <nav className="bg-white shadow-lg sticky top-0 z-50"> |
| 35 | + <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
| 36 | + <div className="flex justify-between h-20"> |
| 37 | + {/* Logo */} |
| 38 | + <div className="flex items-center"> |
| 39 | + <Link to="/" className="flex items-center space-x-3"> |
| 40 | + <img |
| 41 | + src="/images/7763065a-89ed-4786-a8c7-998e28bbf032.webp" |
| 42 | + alt="Dra. Liz Cheng" |
| 43 | + className="h-20 w-auto" |
| 44 | + /> |
46 | 45 | </Link> |
47 | | - ))} |
48 | | - |
49 | | - {/* Social Media Links */} |
50 | | - <div className="flex items-center space-x-3"> |
51 | | - <a |
52 | | - href="https://www.facebook.com/dra.lizcheng" |
53 | | - target="_blank" |
54 | | - rel="noopener noreferrer" |
55 | | - className="text-gray-700 hover:text-dental-600 transition-colors" |
56 | | - > |
57 | | - <Facebook className="h-5 w-5" /> |
58 | | - </a> |
59 | | - <a |
60 | | - href="https://www.instagram.com/dra.lizcheng/" |
61 | | - target="_blank" |
62 | | - rel="noopener noreferrer" |
63 | | - className="text-gray-700 hover:text-dental-600 transition-colors" |
64 | | - > |
65 | | - <Instagram className="h-5 w-5" /> |
66 | | - </a> |
67 | 46 | </div> |
68 | | - |
69 | | - <a |
70 | | - href="https://api.whatsapp.com/send/?phone=51987566993&text=Hola%21+Deseo+agendar+mi+cita%21&type=phone_number&app_absent=0" |
71 | | - target="_blank" |
72 | | - rel="noopener noreferrer" |
73 | | - className="bg-dental-600 hover:bg-dental-700 text-white px-6 py-2 rounded-full text-sm font-medium transition-colors" |
74 | | - > |
75 | | - Agendar Cita |
76 | | - </a> |
77 | | - </div> |
78 | | - |
79 | | - {/* Mobile menu button */} |
80 | | - <div className="md:hidden flex items-center"> |
81 | | - <button |
82 | | - onClick={() => setIsOpen(!isOpen)} |
83 | | - className="text-gray-700 hover:text-dental-600 focus:outline-none" |
84 | | - > |
85 | | - {isOpen ? <X size={24} /> : <Menu size={24} />} |
86 | | - </button> |
87 | | - </div> |
88 | | - </div> |
89 | 47 |
|
90 | | - {/* Mobile Navigation */} |
91 | | - {isOpen && ( |
92 | | - <div className="md:hidden"> |
93 | | - <div className="px-2 pt-2 pb-3 space-y-1 sm:px-3 bg-white border-t"> |
| 48 | + {/* Desktop Navigation */} |
| 49 | + <div className="hidden md:flex items-center space-x-8"> |
94 | 50 | {navigation.map((item) => ( |
95 | 51 | <Link |
96 | 52 | key={item.name} |
97 | 53 | to={item.href} |
98 | | - className={`block px-3 py-2 text-base font-medium transition-colors ${ |
99 | | - isActive(item.href) |
100 | | - ? 'text-dental-600 bg-dental-50' |
101 | | - : 'text-gray-700 hover:text-dental-600 hover:bg-dental-50' |
| 54 | + className={`text-gray-700 hover:text-dental-600 px-3 py-2 text-sm font-medium transition-colors ${ |
| 55 | + isActive(item.href) ? 'text-dental-600 border-b-2 border-dental-600' : '' |
102 | 56 | }`} |
103 | | - onClick={() => setIsOpen(false)} |
104 | 57 | > |
105 | 58 | {item.name} |
106 | 59 | </Link> |
107 | 60 | ))} |
108 | 61 |
|
109 | | - {/* Mobile Social Media Links */} |
110 | | - <div className="flex items-center justify-center space-x-6 py-4"> |
| 62 | + {/* Social Media Links */} |
| 63 | + <div className="flex items-center space-x-3"> |
111 | 64 | <a |
112 | 65 | href="https://www.facebook.com/dra.lizcheng" |
113 | 66 | target="_blank" |
114 | 67 | rel="noopener noreferrer" |
115 | 68 | className="text-gray-700 hover:text-dental-600 transition-colors" |
116 | 69 | > |
117 | | - <Facebook className="h-6 w-6" /> |
| 70 | + <Facebook className="h-5 w-5" /> |
118 | 71 | </a> |
119 | 72 | <a |
120 | 73 | href="https://www.instagram.com/dra.lizcheng/" |
121 | 74 | target="_blank" |
122 | 75 | rel="noopener noreferrer" |
123 | 76 | className="text-gray-700 hover:text-dental-600 transition-colors" |
124 | 77 | > |
125 | | - <Instagram className="h-6 w-6" /> |
| 78 | + <Instagram className="h-5 w-5" /> |
126 | 79 | </a> |
127 | 80 | </div> |
128 | 81 |
|
129 | 82 | <a |
130 | 83 | href="https://api.whatsapp.com/send/?phone=51987566993&text=Hola%21+Deseo+agendar+mi+cita%21&type=phone_number&app_absent=0" |
131 | 84 | target="_blank" |
132 | 85 | rel="noopener noreferrer" |
133 | | - className="block w-full text-center bg-dental-600 hover:bg-dental-700 text-white px-6 py-2 rounded-full text-sm font-medium transition-colors mt-4" |
134 | | - onClick={() => setIsOpen(false)} |
| 86 | + className="bg-dental-600 hover:bg-dental-700 text-white px-6 py-2 rounded-full text-sm font-medium transition-colors" |
135 | 87 | > |
136 | | - Agendar Cita |
| 88 | + {t('nav.schedule')} |
137 | 89 | </a> |
138 | 90 | </div> |
| 91 | + |
| 92 | + {/* Mobile menu button */} |
| 93 | + <div className="md:hidden flex items-center"> |
| 94 | + <button |
| 95 | + onClick={() => setIsOpen(!isOpen)} |
| 96 | + className="text-gray-700 hover:text-dental-600 focus:outline-none" |
| 97 | + > |
| 98 | + {isOpen ? <X size={24} /> : <Menu size={24} />} |
| 99 | + </button> |
| 100 | + </div> |
139 | 101 | </div> |
140 | | - )} |
141 | | - </div> |
142 | | - </nav> |
| 102 | + |
| 103 | + {/* Mobile Navigation */} |
| 104 | + {isOpen && ( |
| 105 | + <div className="md:hidden"> |
| 106 | + <div className="px-2 pt-2 pb-3 space-y-1 sm:px-3 bg-white border-t"> |
| 107 | + {navigation.map((item) => ( |
| 108 | + <Link |
| 109 | + key={item.name} |
| 110 | + to={item.href} |
| 111 | + className={`block px-3 py-2 text-base font-medium transition-colors ${ |
| 112 | + isActive(item.href) |
| 113 | + ? 'text-dental-600 bg-dental-50' |
| 114 | + : 'text-gray-700 hover:text-dental-600 hover:bg-dental-50' |
| 115 | + }`} |
| 116 | + onClick={() => setIsOpen(false)} |
| 117 | + > |
| 118 | + {item.name} |
| 119 | + </Link> |
| 120 | + ))} |
| 121 | + |
| 122 | + {/* Mobile Social Media Links */} |
| 123 | + <div className="flex items-center justify-center space-x-6 py-4"> |
| 124 | + <a |
| 125 | + href="https://www.facebook.com/dra.lizcheng" |
| 126 | + target="_blank" |
| 127 | + rel="noopener noreferrer" |
| 128 | + className="text-gray-700 hover:text-dental-600 transition-colors" |
| 129 | + > |
| 130 | + <Facebook className="h-6 w-6" /> |
| 131 | + </a> |
| 132 | + <a |
| 133 | + href="https://www.instagram.com/dra.lizcheng/" |
| 134 | + target="_blank" |
| 135 | + rel="noopener noreferrer" |
| 136 | + className="text-gray-700 hover:text-dental-600 transition-colors" |
| 137 | + > |
| 138 | + <Instagram className="h-6 w-6" /> |
| 139 | + </a> |
| 140 | + </div> |
| 141 | + |
| 142 | + <a |
| 143 | + href="https://api.whatsapp.com/send/?phone=51987566993&text=Hola%21+Deseo+agendar+mi+cita%21&type=phone_number&app_absent=0" |
| 144 | + target="_blank" |
| 145 | + rel="noopener noreferrer" |
| 146 | + className="block w-full text-center bg-dental-600 hover:bg-dental-700 text-white px-6 py-2 rounded-full text-sm font-medium transition-colors mt-4" |
| 147 | + onClick={() => setIsOpen(false)} |
| 148 | + > |
| 149 | + {t('nav.schedule')} |
| 150 | + </a> |
| 151 | + </div> |
| 152 | + </div> |
| 153 | + )} |
| 154 | + </div> |
| 155 | + </nav> |
| 156 | + </> |
143 | 157 | ); |
144 | 158 | }; |
145 | 159 |
|
|
0 commit comments