mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
c:
This commit is contained in:
@@ -5,26 +5,16 @@ export const ThemeSwitcher = () => {
|
|||||||
const { theme, setTheme } = useTheme()
|
const { theme, setTheme } = useTheme()
|
||||||
|
|
||||||
const toggle = () => {
|
const toggle = () => {
|
||||||
switch (theme) {
|
setTheme(theme === 'light' ? 'dark' : 'light')
|
||||||
case 'dark':
|
|
||||||
setTheme('light')
|
|
||||||
break
|
|
||||||
case 'light':
|
|
||||||
setTheme('dark')
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
setTheme('dark')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
aria-label='Switch Theme'
|
aria-label='Switch Theme'
|
||||||
type='button'
|
type='button'
|
||||||
className={`ml-auto mr-5 mt-5 flex transition duration-300 ease-in-out ${
|
className={`ml-auto mr-5 mt-5 flex transition-colors duration-300 ease-in-out p-2 rounded-full ${
|
||||||
theme === 'light' ? 'hover:bg-gray-300' : 'dark:hover:bg-gray-700'
|
theme === 'light' ? 'hover:bg-gray-300' : 'dark:hover:bg-gray-700'
|
||||||
} p-2 rounded-full`}
|
}`}
|
||||||
onClick={() => toggle()}
|
onClick={() => toggle()}
|
||||||
>
|
>
|
||||||
<VscColorMode size={30} />
|
<VscColorMode size={30} />
|
||||||
|
Reference in New Issue
Block a user