Files
supabase/apps/design-system/hooks/use-config.ts
Jonathan Summers-MuirandIvan Vasilov f912536db8 [Design system] Feat/sonner (#27382)
* fix toast examples

* add sonner stuff

* new sonner examples added

* updated

* add upload POC

* add

* Update sonner-upload.tsx

* move statusicons

* Minor fix.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-07-19 12:38:42 +02:00

30 lines
799 B
TypeScript

import { Style } from '@/registry/styles'
import { Theme } from '@/registry/themes'
import { useAtom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'
import { ComponentProps } from 'react'
import { SonnerToaster } from 'ui'
// import { BackendProvider } from '@/registry/backend-provider'
type Config = {
style: Style['name']
theme: Theme['name']
radius: number
sonnerPosition: ComponentProps<typeof SonnerToaster>['position']
sonnerExpand: boolean
// backendProvider: BackendProvider['name'] | undefined
}
const configAtom = atomWithStorage<Config>('config', {
style: 'default',
theme: 'zinc',
radius: 0.5,
sonnerPosition: 'bottom-right',
sonnerExpand: false,
// backendProvider: 'nextjs-auth',
})
export function useConfig() {
return useAtom(configAtom)
}