diff --git a/app/globals.css b/app/globals.css index ce7a2fc..d29b10b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -25,3 +25,33 @@ body { ) rgb(var(--background-start-rgb)); } +.toggle { + height: 2em; + width: 3em; + border-radius: 50px; + margin: auto; + background-image: linear-gradient(aqua, skyblue); + position: relative; + cursor: pointer; +} +.toggle-dark { + height: 2em; + width: 3em; + border-radius: 50px; + margin: auto; + background-image: linear-gradient(midnightblue, rebeccapurple); + position: relative; + cursor: pointer; +} +.theme-icon{ + margin-left: 0.2em; + height: 2em; + width: 1.2em; + color: yellow; +} + +.theme-icon-dark{ + height: 2em; + width: 1.2em; + margin-left: auto; +} \ No newline at end of file diff --git a/components/ThemeSwitcher.tsx b/components/ThemeSwitcher.tsx index 5af10d2..6314afa 100644 --- a/components/ThemeSwitcher.tsx +++ b/components/ThemeSwitcher.tsx @@ -1,22 +1,37 @@ "use client"; -import { MdOutlineDarkMode, MdLightbulbOutline } from "react-icons/md"; +import { MdBrightness2, MdCircle } from "react-icons/md"; import useDarkMode from "@/hooks/useDarkMode"; +import { useEffect, useState} from 'react' // TODO write tests for light/mode -// TODO new SVG for light/dark theme // TODO fix TS error on setTheme const ThemeSwitcher = () => { + const [mounted, setMounted] = useState(false); const [colorTheme, setTheme] = useDarkMode(); + useEffect(() => { + setMounted(true); + }, []); + + if(!mounted) { + return null; + } + return ( - <> +