@@ -5,19 +5,15 @@ import {ApiInfo} from '@/components/shared/ApiInfo';
55import { settingsStore } from '@/stores/settings-store' ;
66
77export function SettingsForm ( ) {
8- const snap = useStore ( settingsStore ) ;
8+ const store = useStore ( settingsStore ) ;
99
1010 return (
1111 < div className = "bg-card border border-border rounded-lg p-4 space-y-4" >
1212 < h2 className = "font-semibold" > Preferences</ h2 >
1313 < ApiInfo
1414 apis = { [ 'createClassyStore (plain object)' , 'useStore (auto-tracked)' ] }
1515 description = "Plain object store (not a class). Direct property mutation — no setter methods needed."
16- code = { `const settingsStore = createClassyStore({
17- theme: 'system',
18- fontSize: 16,
19- compactMode: false,
20- });
16+ code = { `const settingsStore = create);
2117// mutation: settingsStore.theme = 'dark';` }
2218 />
2319 < p className = "text-xs text-muted" >
@@ -28,7 +24,7 @@ export function SettingsForm() {
2824 < span className = "text-muted text-xs" > Theme</ span >
2925 < select
3026 className = "border border-border bg-background rounded px-3 py-1.5 text-sm"
31- value = { snap . theme }
27+ value = { store . theme }
3228 onChange = { ( e ) => {
3329 settingsStore . theme = e . target . value as 'light' | 'dark' | 'system' ;
3430 } }
@@ -40,12 +36,14 @@ export function SettingsForm() {
4036 </ label >
4137
4238 < label className = "flex flex-col gap-1 text-sm" >
43- < span className = "text-muted text-xs" > Font Size: { snap . fontSize } px</ span >
39+ < span className = "text-muted text-xs" >
40+ Font Size: { store . fontSize } px
41+ </ span >
4442 < input
4543 type = "range"
4644 min = { 12 }
4745 max = { 24 }
48- value = { snap . fontSize }
46+ value = { store . fontSize }
4947 onChange = { ( e ) => {
5048 settingsStore . fontSize = Number ( e . target . value ) ;
5149 } }
@@ -56,7 +54,7 @@ export function SettingsForm() {
5654 < label className = "flex items-center gap-2 text-sm" >
5755 < input
5856 type = "checkbox"
59- checked = { snap . compactMode }
57+ checked = { store . compactMode }
6058 onChange = { ( ) => {
6159 settingsStore . compactMode = ! settingsStore . compactMode ;
6260 } }
@@ -68,7 +66,7 @@ export function SettingsForm() {
6866 < label className = "flex items-center gap-2 text-sm" >
6967 < input
7068 type = "checkbox"
71- checked = { snap . notifications }
69+ checked = { store . notifications }
7270 onChange = { ( ) => {
7371 settingsStore . notifications = ! settingsStore . notifications ;
7472 } }
@@ -82,7 +80,7 @@ export function SettingsForm() {
8280 < input
8381 type = "number"
8482 className = "border border-border bg-background rounded px-3 py-1.5 text-sm w-24"
85- value = { snap . defaultServings }
83+ value = { store . defaultServings }
8684 onChange = { ( e ) => {
8785 settingsStore . defaultServings = Number ( e . target . value ) || 1 ;
8886 } }
@@ -93,7 +91,7 @@ export function SettingsForm() {
9391 < span className = "text-muted text-xs" > Measurement Unit</ span >
9492 < select
9593 className = "border border-border bg-background rounded px-3 py-1.5 text-sm"
96- value = { snap . measurementUnit }
94+ value = { store . measurementUnit }
9795 onChange = { ( e ) => {
9896 settingsStore . measurementUnit = e . target . value as
9997 | 'metric'
0 commit comments