diff --git a/src/app.scss b/src/app.scss index 3368530d..9240ba5b 100644 --- a/src/app.scss +++ b/src/app.scss @@ -19,7 +19,6 @@ body { font-family: var(--font-family); font-size: 1.4rem; height: 100%; - padding: spacing.$unit-2x !important; &.no-scroll { overflow: hidden; diff --git a/src/lib/components/Navigation.svelte b/src/lib/components/Navigation.svelte index 43cf4814..3f6f9bbc 100644 --- a/src/lib/components/Navigation.svelte +++ b/src/lib/components/Navigation.svelte @@ -152,6 +152,7 @@ flex-direction: row; justify-content: space-between; align-items: center; + padding-top: spacing.$unit-2x; ul { background-color: var(--menu-bg); diff --git a/src/lib/components/ui/Sidebar.svelte b/src/lib/components/ui/Sidebar.svelte new file mode 100644 index 00000000..c61e9713 --- /dev/null +++ b/src/lib/components/ui/Sidebar.svelte @@ -0,0 +1,91 @@ + + + + + + + \ No newline at end of file diff --git a/src/lib/components/ui/SidebarHeader.svelte b/src/lib/components/ui/SidebarHeader.svelte new file mode 100644 index 00000000..f4c4c321 --- /dev/null +++ b/src/lib/components/ui/SidebarHeader.svelte @@ -0,0 +1,100 @@ + + + + + + + \ No newline at end of file diff --git a/src/lib/stores/sidebar.svelte.ts b/src/lib/stores/sidebar.svelte.ts new file mode 100644 index 00000000..5c38830b --- /dev/null +++ b/src/lib/stores/sidebar.svelte.ts @@ -0,0 +1,55 @@ +import type { Snippet } from 'svelte' + +// Standard sidebar width +export const SIDEBAR_WIDTH = '420px' + +interface SidebarState { + open: boolean + title?: string + content?: Snippet +} + +class SidebarStore { + state = $state({ + open: false, + title: undefined, + content: undefined + }) + + open(title?: string, content?: Snippet) { + this.state.open = true + this.state.title = title + this.state.content = content + } + + close() { + this.state.open = false + // Clear content after animation + setTimeout(() => { + this.state.title = undefined + this.state.content = undefined + }, 300) + } + + toggle() { + if (this.state.open) { + this.close() + } else { + this.open() + } + } + + get isOpen() { + return this.state.open + } + + get title() { + return this.state.title + } + + get content() { + return this.state.content + } +} + +export const sidebar = new SidebarStore() \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d4c24a4c..458e9d08 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,6 +4,8 @@ import '$src/app.scss' import Navigation from '$lib/components/Navigation.svelte' + import Sidebar from '$lib/components/ui/Sidebar.svelte' + import { sidebar } from '$lib/stores/sidebar.svelte' import { Tooltip } from 'bits-ui' // Get `data` and `children` from the router via $props() @@ -19,8 +21,38 @@ -
- - {@render children?.()} -
+
+
+ + {@render children?.()} +
+ + sidebar.close()} + > + {#if sidebar.content} + {@render sidebar.content()} + {/if} + +
+ + diff --git a/src/routes/test-sidebar/+page.svelte b/src/routes/test-sidebar/+page.svelte new file mode 100644 index 00000000..d2a623e2 --- /dev/null +++ b/src/routes/test-sidebar/+page.svelte @@ -0,0 +1,192 @@ + + + + +
+

Sidebar Test Page

+

Click the buttons below to test different sidebar configurations:

+ +
+ + + +
+ +
+

Main Content Area

+

This content will shrink when the sidebar opens, creating a two-pane layout.

+

All sidebars have a standard width of 420px for consistency.

+

On mobile devices, the sidebar will overlay the main content instead of shrinking it.

+
+
+ +{#snippet searchContent()} + +{/snippet} + +{#snippet detailsContent()} + +{/snippet} + +{#snippet filterContent()} + +{/snippet} + + \ No newline at end of file diff --git a/src/themes/_effects.scss b/src/themes/_effects.scss index 361eeeb9..23ccf941 100644 --- a/src/themes/_effects.scss +++ b/src/themes/_effects.scss @@ -22,6 +22,7 @@ $duration-opacity-fade: 0.12s; $duration-instant: 100ms; // For immediate feedback (switch toggle) $duration-quick: 0.15s; // For quick transitions (dropdowns, menus) $duration-standard: 0.2s; // For standard animations (modals, segments) +$duration-slide: 0.3s; // For sliding panels and sidebars // Gradients $hero--gradient--light: