feat: appearance form validation and update user appearance mode

This commit is contained in:
Bart van der Braak 2024-02-06 22:28:17 +01:00
parent af5267d97a
commit a43f74cc7b
4 changed files with 61 additions and 7 deletions

View file

@ -15,7 +15,9 @@
import * as Form from '$lib/components/ui/form';
import Label from '$lib/components/ui/label/label.svelte';
import { dev } from '$app/environment';
import type { PageData } from '../$types';
export let data: SuperValidated<AppearanceFormSchema>;
export let user: PageData['user'];
</script>
<Form.Root
@ -31,7 +33,7 @@
<Form.Label>Theme</Form.Label>
<Form.Description>Select the theme for the dashboard.</Form.Description>
<Form.Validation />
<Form.RadioGroup class="grid max-w-xl grid-cols-3 gap-8 pt-2" orientation="horizontal">
<Form.RadioGroup class="grid max-w-xl grid-cols-3 gap-8 pt-2" orientation="horizontal" value={user?.appearanceMode}>
<Label for="light" class="[&:has([data-state=checked])>div]:border-primary">
<Form.RadioItem id="light" value="light" class="sr-only" />
<div class="items-center rounded-md border-2 border-muted p-1 hover:border-accent">