All files / features / settings SettingsPage.tsx

80% Statements 24/30
41.66% Branches 5/12
90% Functions 9/10
84.61% Lines 22/26

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  63x   63x 63x                             6x 18x 18x 6x                                  
import { useUiStore, type Theme } from '@/layouts/uiStore'
 
const themes: { value: Theme; label: string }[] = [
  { value: 'dark', label: 'Dark' },
  { value: 'light', label: 'Light' },
  { value: 'high-contrast', label: 'High Contrast' },
]
 
export function SettingsPage() {
  const currentTheme = useUiStore((s) => s.theme)
  const setTheme = useUiStore((s) => s.setTheme)
 
  return (
    <div className="mx-auto max-w-lg">
      <h1 className="mb-6 text-2xl font-bold">Settings</h1>
      <section className="rounded-lg border border-border p-4">
        <h2 className="mb-4 text-lg font-semibold">Theme</h2>
        <div className="flex flex-col gap-2">
          {themes.map((t) => (
            <label
              key={t.value}
              className="flex cursor-pointer items-center gap-3 rounded-md p-3 hover:bg-accent"
            >
              <input
                type="radio"
                name="theme"
                value={t.value}
                checked={currentTheme === t.value}
                onChange={() => setTheme(t.value)}
                className="accent-primary"
              />
              <span className="text-sm">{t.label}</span>
            </label>
          ))}
        </div>
      </section>
    </div>
  )
}