add:sidebar toggle and fix overscroll behavior

This commit is contained in:
2025-11-17 11:57:09 +01:00
parent d8cab06e90
commit 1c31e2cdda
2 changed files with 71 additions and 2 deletions

View File

@@ -88,6 +88,7 @@
box-sizing: border-box; box-sizing: border-box;
margin: 0; margin: 0;
padding: 0; padding: 0;
overscroll-behavior: none;
} }
body { body {

View File

@@ -94,6 +94,7 @@
let showCreateModal = $state(false); let showCreateModal = $state(false);
let selectedFind: FindPreviewData | null = $state(null); let selectedFind: FindPreviewData | null = $state(null);
let currentFilter = $state('all'); let currentFilter = $state('all');
let isSidebarVisible = $state(true);
// Initialize API sync with server data on mount // Initialize API sync with server data on mount
onMount(async () => { onMount(async () => {
@@ -215,6 +216,10 @@
function closeCreateModal() { function closeCreateModal() {
showCreateModal = false; showCreateModal = false;
} }
function toggleSidebar() {
isSidebarVisible = !isSidebarVisible;
}
</script> </script>
<svelte:head> <svelte:head>
@@ -248,8 +253,19 @@
/> />
</div> </div>
<!-- Toggle button -->
<button class="sidebar-toggle" onclick={toggleSidebar} aria-label="Toggle finds list">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
{#if isSidebarVisible}
<path d="M15 18l-6-6 6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
{:else}
<path d="M9 18l6-6-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
{/if}
</svg>
</button>
<!-- Left sidebar with finds list --> <!-- Left sidebar with finds list -->
<div class="finds-sidebar"> <div class="finds-sidebar" class:hidden={!isSidebarVisible}>
<div class="finds-header"> <div class="finds-header">
<FindsFilter {currentFilter} onFilterChange={handleFilterChange} /> <FindsFilter {currentFilter} onFilterChange={handleFilterChange} />
<Button onclick={openCreateModal} class="create-find-button"> <Button onclick={openCreateModal} class="create-find-button">
@@ -304,10 +320,38 @@
box-shadow: none !important; box-shadow: none !important;
} }
.sidebar-toggle {
position: fixed;
top: 90px;
left: 20px;
width: 48px;
height: 48px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border: none;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
z-index: 60;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
.sidebar-toggle:hover {
background: rgba(255, 255, 255, 1);
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}
.sidebar-toggle svg {
color: #333;
}
.finds-sidebar { .finds-sidebar {
position: fixed; position: fixed;
top: 80px; top: 80px;
left: 20px; left: 80px;
width: 40%; width: 40%;
max-width: 1000px; max-width: 1000px;
min-width: 500px; min-width: 500px;
@@ -320,6 +364,15 @@
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
transition:
transform 0.3s ease,
opacity 0.3s ease;
}
.finds-sidebar.hidden {
transform: translateX(-100%);
opacity: 0;
pointer-events: none;
} }
.finds-header { .finds-header {
@@ -342,6 +395,17 @@
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.sidebar-toggle {
top: auto;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
.sidebar-toggle svg {
transform: rotate(90deg);
}
.finds-sidebar { .finds-sidebar {
top: auto; top: auto;
bottom: 0; bottom: 0;
@@ -355,6 +419,10 @@
box-sizing: border-box; box-sizing: border-box;
} }
.finds-sidebar.hidden {
transform: translateY(100%);
}
.finds-header { .finds-header {
padding: 16px; padding: 16px;
} }