mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-13 16:30:31 +00:00
further restructuring
This commit is contained in:
parent
9b07f3eb90
commit
4386999c38
55 changed files with 224 additions and 224 deletions
30
src/components/toggles/theme.jsx
Normal file
30
src/components/toggles/theme.jsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { useContext } from "react";
|
||||
import { MdDarkMode, MdLightMode, MdToggleOff, MdToggleOn } from "react-icons/md";
|
||||
|
||||
import { ThemeContext } from "utils/contexts/theme";
|
||||
|
||||
export default function ThemeToggle() {
|
||||
const { theme, setTheme } = useContext(ThemeContext);
|
||||
|
||||
if (!theme) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="rounded-full flex self-end">
|
||||
<MdLightMode className="text-theme-800 dark:text-theme-200 w-5 h-5 m-1.5" />
|
||||
{theme === "dark" ? (
|
||||
<MdToggleOn
|
||||
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
||||
className="text-theme-800 dark:text-theme-200 w-8 h-8 cursor-pointer"
|
||||
/>
|
||||
) : (
|
||||
<MdToggleOff
|
||||
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
||||
className="text-theme-800 dark:text-theme-200 w-8 h-8 cursor-pointer"
|
||||
/>
|
||||
)}
|
||||
<MdDarkMode className="text-theme-800 dark:text-theme-200 w-5 h-5 m-1.5" />
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue