Files
shadcn-ui/apps/www/hooks/use-config.ts
2023-12-22 23:36:59 +04:00

22 lines
419 B
TypeScript

import { useAtom } from "jotai"
import { atomWithStorage } from "jotai/utils"
import { Style } from "@/registry/styles"
import { Theme } from "@/registry/themes"
type Config = {
style: Style["name"]
theme: Theme["name"]
radius: number
}
const configAtom = atomWithStorage<Config>("config", {
style: "new-york",
theme: "zinc",
radius: 0.5,
})
export function useConfig() {
return useAtom(configAtom)
}