From 6730e7ac0e1ca64b59df7836df328a033f870bbf Mon Sep 17 00:00:00 2001 From: vincanger <70215737+vincanger@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:00:16 +0200 Subject: [PATCH] Fix darkmode switcher styling (#263) * Update DarkModeSwitcher.tsx * Update tailwind.config.cjs.diff * extract repetitive code * Update DarkModeSwitcher.tsx --- .../client/components/DarkModeSwitcher.tsx | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/template/app/src/client/components/DarkModeSwitcher.tsx b/template/app/src/client/components/DarkModeSwitcher.tsx index 4fe67ce1..249089bb 100644 --- a/template/app/src/client/components/DarkModeSwitcher.tsx +++ b/template/app/src/client/components/DarkModeSwitcher.tsx @@ -3,56 +3,69 @@ import useColorMode from '../hooks/useColorMode'; const DarkModeSwitcher = () => { const [colorMode, setColorMode] = useColorMode(); + const isInLightMode = colorMode === 'light'; return (
-
); -}; +}; + +function ModeIcon({ isInLightMode }: { isInLightMode: boolean }) { + const iconStyle = 'absolute inset-0 flex items-center justify-center transition-opacity ease-in-out duration-400'; + return ( + <> + + + + ); +} + +function SunIcon() { + return ( + + + + + ); +} + +function MoonIcon() { + return ( + + + + ); +} export default DarkModeSwitcher;