Remade side bar to work better on phone and tablet

This commit is contained in:
2026-03-08 14:40:29 -04:00
parent 72e031a99d
commit 9388bf17af
3 changed files with 144 additions and 11 deletions

View File

@@ -13,6 +13,7 @@
/** @type {'dashboard' | 'tasks' | 'users'} */
let currentView = $state("dashboard");
let mobileMenuOpen = $state(false);
let systemInfo = $state({
chip: "—",
@@ -139,9 +140,35 @@
</script>
<div class="app-layout">
<Sidebar {currentView} onNavigate={(view) => currentView = view} />
<Sidebar
{currentView}
isOpen={mobileMenuOpen}
onNavigate={(view) => { currentView = view; mobileMenuOpen = false; }}
onToggle={() => mobileMenuOpen = !mobileMenuOpen}
/>
{#if mobileMenuOpen}
<button
class="mobile-backdrop"
onclick={() => mobileMenuOpen = false}
aria-label="Close menu"
></button>
{/if}
<main class="main-content">
<!-- Mobile Top Bar -->
<header class="mobile-header">
<button class="hamburger" onclick={() => mobileMenuOpen = true}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</button>
<span class="mobile-title">Calendink</span>
<div style="width: 40px;"></div> <!-- Spacer -->
</header>
<div class="w-full max-w-6xl mx-auto space-y-8">
<!-- Header -->
<div class="text-center">
@@ -370,13 +397,77 @@
.main-content {
flex: 1;
padding: 16px 32px;
padding: 32px;
height: 100vh;
overflow-y: auto;
background: radial-gradient(circle at top right, var(--color-bg-card), transparent 40%),
var(--color-bg-primary);
}
.mobile-header {
display: none;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
background: var(--color-bg-card);
border-bottom: 1px solid var(--color-border);
position: sticky;
top: 0;
z-index: 50;
backdrop-filter: blur(10px);
}
.hamburger {
background: none;
border: none;
color: var(--color-text-primary);
padding: 8px;
cursor: pointer;
}
.hamburger svg {
width: 24px;
height: 24px;
}
.mobile-title {
font-weight: 700;
font-size: 16px;
letter-spacing: -0.02em;
color: var(--color-accent);
}
.mobile-backdrop {
display: none;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
z-index: 999;
border: none;
padding: 0;
cursor: pointer;
animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@media (max-width: 768px) {
.main-content {
padding: 16px;
height: auto;
}
.mobile-header {
display: flex;
margin: -16px -16px 20px -16px;
}
.mobile-backdrop {
display: block;
}
}
</style>