mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Footer theme switcher (#894)
* Footer theme switcher * Remove lazy loading & change rotation animation * Changes * Update ThemeSwitcher.tsx * Requested style changes * Update ThemeSwitcher.tsx * Fix alignment * Update ThemeSwitcher.tsx
This commit is contained in:
11
site/lib/hooks/useToggleTheme.ts
Normal file
11
site/lib/hooks/useToggleTheme.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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 }
|
||||
}
|
Reference in New Issue
Block a user