improve header navigation styling and active link highlighting
Optimize header link spacing and add visual feedback for active pages: - Reduce link padding and gap for more compact navigation - Shorten German labels: "In Saison" to "Saison", "Stichwörter" to "Tags" - Remove "Tipps" section from navigation menu Add active page highlighting across all layouts: - Highlight current page links in red (matching hover color) - Desktop: animated red underline that smoothly slides between links - Mobile: static red underline for active links in hamburger menu - Underline aligns precisely with text width (excludes padding) Improve transitions: - Fix color transition to only animate color, not layout properties - Disable underline transition during window resize to prevent lag - Underline updates immediately on resize for perfect alignment
This commit is contained in:
@@ -38,19 +38,29 @@
|
||||
// Close the modal
|
||||
showModal = false;
|
||||
paymentId = null;
|
||||
|
||||
|
||||
// Dispatch a custom event to trigger dashboard refresh
|
||||
if ($page.route.id === '/cospend') {
|
||||
window.dispatchEvent(new CustomEvent('dashboardRefresh'));
|
||||
}
|
||||
}
|
||||
|
||||
function isActive(path) {
|
||||
const currentPath = $page.url.pathname;
|
||||
// Exact match for cospend root
|
||||
if (path === '/cospend') {
|
||||
return currentPath === '/cospend' || currentPath === '/cospend/';
|
||||
}
|
||||
// For other paths, check if current path starts with the link path
|
||||
return currentPath.startsWith(path);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Header>
|
||||
<ul class="site_header" slot="links">
|
||||
<li><a href="/cospend">Dashboard</a></li>
|
||||
<li><a href="/cospend/payments">All Payments</a></li>
|
||||
<li><a href="/cospend/recurring">Recurring Payments</a></li>
|
||||
<li><a href="/cospend" class:active={isActive('/cospend')}>Dashboard</a></li>
|
||||
<li><a href="/cospend/payments" class:active={isActive('/cospend/payments')}>All Payments</a></li>
|
||||
<li><a href="/cospend/recurring" class:active={isActive('/cospend/recurring')}>Recurring Payments</a></li>
|
||||
</ul>
|
||||
<UserHeader slot="right_side" {user}></UserHeader>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user