mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 00:43:15 +00:00
feat(client): calm page changes on the desktop and sections loaded ahead
The desktop now runs the View Transition the phone already had: one short cross-fade under a navbar that stands still. The route fallback holds the previous page until the new one is ready (at most 350 ms), so the full-screen spinner no longer flashes. Once signed in, the main sections' code loads in the background, so the first switch to one does not wait for it. The shared transition helpers move to utils/viewTransition.ts. The navbar tabs lose their title tooltips; their aria-label stays.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Changing page on the desktop (mobile/routeTransition.ts marks it 'page'): one
|
||||
* short cross-fade, the old page and the new at the same time, with nothing
|
||||
* moving. Short on purpose: a page change has to feel like an answer to the
|
||||
* click, not like something to wait for. The navbar keeps its own name, so it
|
||||
* stands still above the pages instead of fading with them; it switches to its
|
||||
* new state at once.
|
||||
*/
|
||||
[data-desktop-navbar] {
|
||||
view-transition-name: trek-navbar;
|
||||
}
|
||||
|
||||
@keyframes trek-page-out {
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes trek-page-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-route-transition='page']::view-transition-old(root) {
|
||||
animation: trek-page-out 0.14s ease-out both;
|
||||
}
|
||||
|
||||
:root[data-route-transition='page']::view-transition-new(root) {
|
||||
animation: trek-page-in 0.14s ease-out both;
|
||||
}
|
||||
|
||||
::view-transition-old(trek-navbar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::view-transition-new(trek-navbar) {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root[data-route-transition='page']::view-transition-old(root),
|
||||
:root[data-route-transition='page']::view-transition-new(root) {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user