fix: theme switcher

This commit is contained in:
Jing Hua 2023-03-04 12:23:16 +08:00
parent ae835c1791
commit 29f8fe75f3

View file

@ -34,18 +34,18 @@ const ThemeSwitcher = () => {
}
}, [theme]);
return (
theme && (
<a
className='flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm'
onClick={switchTheme}
>
{theme === 'dark' ? <SunIcon /> : <MoonIcon />}
{getOppositeTheme(theme).charAt(0).toUpperCase() +
getOppositeTheme(theme).slice(1)}{' '}
mode
</a>
)
return theme ? (
<a
className='flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm'
onClick={switchTheme}
>
{theme === 'dark' ? <SunIcon /> : <MoonIcon />}
{getOppositeTheme(theme).charAt(0).toUpperCase() +
getOppositeTheme(theme).slice(1)}{' '}
mode
</a>
) : (
<></>
);
};