Skip to content

Commit ae4cf3f

Browse files
committed
Simplify router transitions using overlay fade effect and cleanup CSS
1 parent 473f88f commit ae4cf3f

File tree

4 files changed

+83
-290
lines changed

4 files changed

+83
-290
lines changed

.roo/rules/03-router-transitions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
- Ensure proper cleanup of transition elements
2020
- Use display: none/block instead of opacity for complete isolation
2121
- Prepare new DOM with display: none before removing old DOM
22+
- Use a full-screen overlay with fade transitions during route changes
23+
- Apply smooth fade-in/fade-out effects to minimize visual disruption
2224

2325
## Styling During Transitions
2426
- Maintain consistent theme colors during transitions

HUMAN-TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# todo
22

3-
- [ ] speed up build. (currently takes 67 seconds)
3+
- [ ] speed up build. (currently takes 67 seconds)
4+
- [ ] break up css files into ./main.css (loads fonts.css, theme.css, reset.css, forms.css etc etc)

public/css/theme.css

Lines changed: 12 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -153,85 +153,22 @@ html, body, #app {
153153
padding: 0;
154154
}
155155

156-
/* Route containers */
157-
.new-route-container,
158-
.current-route-container,
159-
.route-content {
160-
width: 100%;
161-
min-height: 100vh;
162-
background-color: var(--background-color);
163-
color: var(--text-primary);
164-
}
165-
166-
/* Absolute positioning for transition containers */
167-
.new-route-container,
168-
.current-route-container {
169-
position: absolute;
170-
top: 0;
171-
left: 0;
172-
right: 0;
173-
bottom: 0;
174-
overflow: hidden;
175-
}
176-
177-
.new-route-container {
178-
z-index: 5;
179-
/* Initially hidden, will be shown via JS */
180-
display: none;
181-
}
182-
183-
.current-route-container {
184-
z-index: 1;
185-
display: block;
186-
}
187-
188-
/* The final route content container */
189-
.route-content {
190-
display: block;
191-
position: relative;
192-
}
193-
194-
/* Ensure proper styling during transitions */
195-
.new-route-container *,
196-
.current-route-container *,
197-
.route-content * {
198-
color: var(--text-primary);
199-
transition: color var(--transition-normal);
200-
}
201-
202-
/* Prevent any content from showing through during transitions */
203-
.new-route-container::before,
204-
.current-route-container::before {
205-
content: "";
206-
position: absolute;
156+
/* Transition overlay */
157+
.transition-overlay {
158+
position: fixed;
207159
top: 0;
208160
left: 0;
209161
right: 0;
210162
bottom: 0;
163+
width: 100vw;
164+
height: 100vh;
211165
background-color: var(--background-color);
212-
z-index: -1;
213-
}
214-
215-
.loading {
216-
display: flex;
217-
align-items: center;
218-
justify-content: center;
219-
font-size: var(--font-size-lg);
220-
color: var(--text-primary);
221-
padding: var(--spacing-xl);
222-
}
223-
224-
/* Ensure all text elements maintain proper coloring during transitions */
225-
body, h1, h2, h3, h4, h5, h6, p, span, a, button, input, textarea, select, label, li {
226-
color: var(--text-primary);
227-
transition: color var(--transition-normal);
228-
}
229-
230-
/* Prevent FOUC (Flash of Unstyled Content) during transitions */
231-
.new-route-container *,
232-
.current-route-container * {
233-
color: var(--text-primary) !important;
234-
background-color: var(--background-color);
166+
z-index: 9999;
167+
display: block;
168+
overflow: hidden;
169+
opacity: 0;
170+
transition: opacity 150ms ease-in-out;
171+
pointer-events: none; /* Allow clicks to pass through when faded out */
235172
}
236173

237174
/* Theme toggle styles */
@@ -412,29 +349,4 @@ body, h1, h2, h3, h4, h5, h6, p, span, a, button, input, textarea, select, label
412349
.bg-primary { background-color: var(--primary-color); }
413350
.bg-secondary { background-color: var(--secondary-color); }
414351
.bg-surface { background-color: var(--surface-color); }
415-
.bg-surface-variant { background-color: var(--surface-variant); }
416-
417-
/* JavaScript for theme toggle */
418-
/*
419-
document.addEventListener('DOMContentLoaded', () => {
420-
const themeToggle = document.querySelector('.theme-toggle');
421-
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
422-
423-
// Check for saved theme preference or use the system preference
424-
const savedTheme = localStorage.getItem('theme');
425-
if (savedTheme === 'dark' || (!savedTheme && prefersDarkScheme.matches)) {
426-
document.documentElement.setAttribute('data-theme', 'dark');
427-
} else {
428-
document.documentElement.setAttribute('data-theme', 'light');
429-
}
430-
431-
// Toggle theme when the button is clicked
432-
themeToggle.addEventListener('click', () => {
433-
const currentTheme = document.documentElement.getAttribute('data-theme') || 'light';
434-
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
435-
436-
document.documentElement.setAttribute('data-theme', newTheme);
437-
localStorage.setItem('theme', newTheme);
438-
});
439-
});
440-
*/
352+
.bg-surface-variant { background-color: var(--surface-variant); }

0 commit comments

Comments
 (0)