blob: 2e0b7b7542113456062725c1d8c9ba068ab0888a [file] [log] [blame]
/** @jsxImportSource theme-ui */
import { useColorMode } from 'theme-ui';
import Styles from '../styles/Components/navbar.module.css';
import { useState, useEffect } from 'react';
const ThemeChangeButton = () => {
const [colorMode, setColorMode] = useColorMode()
const [render, setRender] = useState(false);
useEffect(() => {
setRender(true);
}, []);
return (
<>
<a className={Styles.icon + " " + Styles.themeChangeIcon} onClick={(e) => {
e.preventDefault();
setColorMode(colorMode === 'light' ? 'dark' : 'light');
}} href="#">
<img className={Styles.icon + " " + Styles.themeChangeIcon} alt="Theme" src={"https://assets.clicks.codes/web/icons/light.svg"} />
<img className={Styles.icon + " " + Styles.themeChangeIcon} alt="Theme" src={"https://assets.clicks.codes/web/icons/dark.svg"} />
</a>
</>
)
}
export default ThemeChangeButton;