|
1 | 1 | --- |
2 | | -
|
| 2 | +// Nota: 'astro:transitions' no disponible (tipos no presentes). Usamos clase utilitaria para fade. |
| 3 | +const navFade = 'fade-link'; |
3 | 4 | --- |
4 | 5 |
|
5 | 6 | <a |
|
27 | 28 | > |
28 | 29 | <a |
29 | 30 | href="/cronograma" |
| 31 | + transition:persist |
| 32 | + class:list={[navFade]} |
30 | 33 | data-section="cronograma" |
31 | 34 | class="nav-link px-4 py-2 rounded-lg border-2 border-transparent hover:text-[#FFC727] focus-visible:text-[#FFC727] focus-visible:border-[#FFC727] focus:outline-none transition" |
32 | 35 | >Cronograma</a |
33 | 36 | > |
34 | 37 | <a |
35 | 38 | href="/#ubicacion" |
| 39 | + transition:persist |
| 40 | + class:list={[navFade]} |
36 | 41 | data-section="ubicacion" |
37 | 42 | class="nav-link px-4 py-2 rounded-lg border-2 border-transparent hover:text-[#FFC727] focus-visible:text-[#FFC727] focus-visible:border-[#FFC727] focus:outline-none transition" |
38 | 43 | >Ubicación</a |
39 | 44 | > |
40 | 45 | <a |
41 | 46 | href="/#sponsors" |
| 47 | + transition:persist |
| 48 | + class:list={[navFade]} |
42 | 49 | data-section="sponsors" |
43 | 50 | class="nav-link px-4 py-2 rounded-lg border-2 border-transparent hover:text-[#FFC727] focus-visible:text-[#FFC727] focus-visible:border-[#FFC727] focus:outline-none transition" |
44 | 51 | >Sponsors</a |
45 | 52 | > |
46 | 53 | <a |
47 | 54 | href="/#sobre-nosotros" |
| 55 | + transition:persist |
| 56 | + class:list={[navFade]} |
48 | 57 | data-section="sobre-nosotros" |
49 | 58 | class="nav-link px-4 py-2 rounded-lg border-2 border-transparent hover:text-[#FFC727] focus-visible:text-[#FFC727] focus-visible:border-[#FFC727] focus:outline-none transition" |
50 | 59 | >Sobre nosotros</a |
51 | 60 | > |
52 | 61 | <a |
53 | 62 | href="/faqs" |
| 63 | + transition:persist |
| 64 | + class:list={[navFade]} |
54 | 65 | data-section="faqs" |
55 | 66 | class="nav-link px-4 py-2 rounded-lg border-2 border-transparent hover:text-[#FFC727] focus-visible:text-[#FFC727] focus-visible:border-[#FFC727] focus:outline-none transition" |
56 | 67 | >FAQs</a |
|
109 | 120 | <li> |
110 | 121 | <a |
111 | 122 | href="/cronograma" |
| 123 | + transition:persist |
| 124 | + class:list={[navFade]} |
112 | 125 | class="block py-3 px-3 rounded-lg border-2 border-transparent hover:bg-white/10 transition" |
113 | 126 | >Cronograma</a |
114 | 127 | > |
115 | 128 | </li> |
116 | 129 | <li> |
117 | 130 | <a |
118 | 131 | href="/#ubicacion" |
| 132 | + transition:persist |
| 133 | + class:list={[navFade]} |
119 | 134 | class="block py-3 px-3 rounded-lg border-2 border-transparent hover:bg-white/10 transition" |
120 | 135 | >Ubicación</a |
121 | 136 | > |
122 | 137 | </li> |
123 | 138 | <li> |
124 | 139 | <a |
125 | 140 | href="/#sponsors" |
| 141 | + transition:persist |
| 142 | + class:list={[navFade]} |
126 | 143 | class="block py-3 px-3 rounded-lg border-2 border-transparent hover:bg-white/10 transition" |
127 | 144 | >Sponsors</a |
128 | 145 | > |
129 | 146 | </li> |
130 | 147 | <li> |
131 | 148 | <a |
132 | 149 | href="/#sobre-nosotros" |
| 150 | + transition:persist |
| 151 | + class:list={[navFade]} |
133 | 152 | class="block py-3 px-3 rounded-lg border-2 border-transparent hover:bg-white/10 transition" |
134 | 153 | >Sobre nosotros</a |
135 | 154 | > |
136 | 155 | </li> |
137 | 156 | <li> |
138 | 157 | <a |
139 | 158 | href="/faqs" |
| 159 | + transition:persist |
| 160 | + class:list={[navFade]} |
140 | 161 | class="block py-3 px-3 rounded-lg border-2 border-transparent hover:bg-white/10 transition" |
141 | 162 | >FAQs</a |
142 | 163 | > |
143 | 164 | </li> |
144 | 165 | </ul> |
145 | 166 | <div class="pt-3"> |
146 | 167 | <a |
147 | | - href="#" |
| 168 | + href="https://forms.gle/5tt3AwhfMw22aKBD6" |
| 169 | + target="_blank" |
| 170 | + rel="noopener noreferrer" |
148 | 171 | aria-label="Registrate" |
149 | 172 | class="block text-center bg-[#178F4E] hover:bg-[#11733E] text-white hover:text-[#FFC727] font-bold py-3 px-10 rounded-md border-2 border-white hover:border-[#FFC727] transition shadow-sm tracking-wide text-[20px] leading-none focus:outline-none" |
150 | 173 | > |
|
261 | 284 | } |
262 | 285 | }); |
263 | 286 | } |
| 287 | + |
| 288 | + // View Transition + smooth scroll para enlaces hash internos |
| 289 | + const hashLinks = document.querySelectorAll('a[href^="/#"], a[href^="#"]'); |
| 290 | + hashLinks.forEach((el) => { |
| 291 | + const link = el as HTMLAnchorElement; |
| 292 | + link.addEventListener('click', (e) => { |
| 293 | + const url = new URL(link.href, window.location.origin); |
| 294 | + const hash = url.hash.replace('#', ''); |
| 295 | + if (!hash) return; |
| 296 | + const target = document.getElementById(hash); |
| 297 | + if (!target) return; |
| 298 | + // Solo manejar si es misma página |
| 299 | + if (url.pathname === window.location.pathname) { |
| 300 | + e.preventDefault(); |
| 301 | + const doScroll = () => { |
| 302 | + target.scrollIntoView({ behavior: 'smooth', block: 'start' }); |
| 303 | + history.pushState(null, '', '#' + hash); |
| 304 | + }; |
| 305 | + if (document.startViewTransition) { |
| 306 | + document.startViewTransition(doScroll); |
| 307 | + } else { |
| 308 | + doScroll(); |
| 309 | + } |
| 310 | + } |
| 311 | + }); |
| 312 | + }); |
264 | 313 | </script> |
265 | 314 | </header> |
266 | 315 | <style> |
|
270 | 319 | font-size: 20px; |
271 | 320 | } |
272 | 321 | </style> |
| 322 | +<style> |
| 323 | + .fade-link { |
| 324 | + view-transition-name: fade-link; |
| 325 | + } |
| 326 | + ::view-transition-old(fade-link), |
| 327 | + ::view-transition-new(fade-link) { |
| 328 | + animation: fade-link-fade 0.4s ease; |
| 329 | + } |
| 330 | + @keyframes fade-link-fade { |
| 331 | + from { |
| 332 | + opacity: 0; |
| 333 | + } |
| 334 | + to { |
| 335 | + opacity: 1; |
| 336 | + } |
| 337 | + } |
| 338 | +</style> |
0 commit comments