import { useContext } from "react"; import { MdDarkMode, MdLightMode, MdToggleOff, MdToggleOn } from "react-icons/md"; import { ThemeContext } from "utils/theme-context"; export default function ThemeToggle() { const { theme, setTheme } = useContext(ThemeContext); if (!theme) { return null; } return (
{theme === "dark" ? ( setTheme(theme === "dark" ? "light" : "dark")} className="text-theme-800 dark:text-theme-200 w-8 h-8 cursor-pointer" /> ) : ( setTheme(theme === "dark" ? "light" : "dark")} className="text-theme-800 dark:text-theme-200 w-8 h-8 cursor-pointer" /> )}
); }