Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

801 B
Raw Blame
import { useAtom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'
import { ComponentProps } from 'react'
import { SonnerToaster } from 'ui'

import { Style } from '@/registry/styles'
import { Theme } from '@/registry/themes'

// 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)
}