Add wide-page layout toggle to Settings
Adds a persisted per-browser preference to widen page content to full browser width, alongside the existing theme switcher and language selector reachable from the header profile dropdown's Settings entry. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
81b62cdc26
commit
32104550cb
3 files changed
+46
No files matched your search
@@ -95,3 +95,8 @@ body {
|
||||
background-color: var(--color-primary);
|
||||
color: var(--color-primary-fg);
|
||||
}
|
||||
|
||||
/* Wide-page setting: lifts the shared shell's default max-width cap on the main content area. */
|
||||
[data-wide-layout='true'] .sc-main {
|
||||
width: calc(100% - 2rem);
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
import { SettingsDialog as SharedSettingsDialog } from '@gabriel20xx/web-ui';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '$lib/components/ui/select';
|
||||
import { currentLanguage, languages, setLanguage } from '$lib/language.svelte.js';
|
||||
import { layoutState } from '$lib/layout.svelte.js';
|
||||
import { themeState } from '$lib/theme.svelte.js';
|
||||
|
||||
let { open = $bindable(false) } = $props();
|
||||
@@ -60,6 +61,15 @@
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<label class="mt-5 flex items-center justify-between gap-2">
|
||||
<span class="text-sm font-medium">Wide page</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={layoutState.wide}
|
||||
onchange={(event) => layoutState.setWide(event.currentTarget.checked)}
|
||||
class="size-4 rounded border-border accent-primary"
|
||||
/>
|
||||
</label>
|
||||
<div class="sc-form-actions">
|
||||
<Button type="button" variant="secondary" onclick={() => (open = false)}>Dismiss</Button>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
const STORAGE_KEY = 'collabtable-wide-layout';
|
||||
|
||||
function loadInitialWide() {
|
||||
if (!browser) return false;
|
||||
return localStorage.getItem(STORAGE_KEY) === 'true';
|
||||
}
|
||||
|
||||
let wide = $state(loadInitialWide());
|
||||
|
||||
export const layoutState = {
|
||||
get wide() {
|
||||
return wide;
|
||||
},
|
||||
setWide(next) {
|
||||
wide = next;
|
||||
if (browser) localStorage.setItem(STORAGE_KEY, String(next));
|
||||
},
|
||||
toggle() {
|
||||
layoutState.setWide(!wide);
|
||||
},
|
||||
};
|
||||
|
||||
if (browser) {
|
||||
$effect.root(() => {
|
||||
$effect(() => {
|
||||
document.documentElement.toggleAttribute('data-wide-layout', wide);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user