Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 10x 10x 2x | import { useContext } from "react";
import { GlobalContext } from "../contexts/GlobalContext";
import { IoMoon, IoSunny } from "react-icons/io5";
import styles from "../styles/components/ChangeColor.module.css";
export function Changecolor() {
const { changelight, lightState } = useContext(GlobalContext);
return (
<div className={styles.container}>
<span
data-testid="LightModeButtom"
onClick={() => {
changelight(!lightState);
}}
>
{lightState ? (
<IoSunny data-testid="SunnyIcon" className={styles.icon} />
) : (
<IoMoon data-testid="MoonIcon" className={styles.icon} />
)}
</span>
</div>
);
}
|