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>
23 lines
578 B
TypeScript
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' },
|
|
),
|
|
);
|