mirror of
https://github.com/vercel/commerce.git
synced 2025-03-28 16:25:53 +00:00
* Footer theme switcher * Remove lazy loading & change rotation animation * Changes * Update ThemeSwitcher.tsx * Requested style changes * Update ThemeSwitcher.tsx * Fix alignment * Update ThemeSwitcher.tsx
12 lines
338 B
TypeScript
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 }
|
|
}
|