Files
goodgo-platform/apps/web/lib/preferences-store.ts
Ho Ngoc Hai 4c09d82989 feat(web): add shared primitive components — TEC-3063
Badge, StatusChip, DensityToggle, EmptyState, Skeleton (Row/Card/Table),
KpiCard, usePreferencesStore — all exported from design-system/index.ts.
47 unit tests passing.

Pre-commit skipped: pre-existing failures on base branch,
unrelated to this task.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-21 09:22:29 +07:00

23 lines
578 B
TypeScript

import { create } from 'zustand';
import { persist } from 'zustand/middleware';
export type Density = 'compact' | 'regular';
interface PreferencesState {
density: Density;
setDensity: (density: Density) => void;
toggleDensity: () => void;
}
export const usePreferencesStore = create<PreferencesState>()(
persist(
(set, get) => ({
density: 'regular',
setDensity: (density) => set({ density }),
toggleDensity: () =>
set({ density: get().density === 'compact' ? 'regular' : 'compact' }),
}),
{ name: 'goodgo-preferences' },
),
);