1
0
mirror of https://github.com/vercel/commerce.git synced 2025-03-28 16:25:53 +00:00
commerce/site/lib/hooks/useToggleTheme.ts
Catalin Pinte 6d783eae35
Footer theme switcher ()
* Footer theme switcher

* Remove lazy loading & change rotation animation

* Changes

* Update ThemeSwitcher.tsx

* Requested style changes

* Update ThemeSwitcher.tsx

* Fix alignment

* Update ThemeSwitcher.tsx
2022-11-30 10:07:44 -05:00

12 lines
338 B
TypeScript

import { useTheme } from 'next-themes'
import { useEffect, useState } from 'react'
export const useToggleTheme = () => {
const { theme, themes, setTheme } = useTheme()
const [themeValue, setThemeValue] = useState<string>('system')
useEffect(() => setThemeValue(theme), [theme])
return { theme: themeValue, setTheme, themes }
}