import styles from "styles/ThemeToggle.module.sass";
import { useTheme } from "next-themes";
import Icon from "components/Icon";

function the(t) {
    switch (t) {
        case "light":
            return "dark";
        case "dark":
            return "light";
    }
}

const ThemeToggle = () => {
    const { resolvedTheme: theme, setTheme } = useTheme();

    return (
        <>
            <button data-theme={theme} onClick={() => setTheme(the(theme))} className={styles.button}>
                <Icon icon="asterisk" />
            </button>
        </>
    );
};

export default ThemeToggle;
