blob: 50f1cc2f5959250235495af5586a20c6b5105ac1 [file] [log] [blame]
Skyler Turner16c08d32021-11-04 20:06:50 +00001/** @jsxImportSource theme-ui */
2import { useColorMode } from 'theme-ui';
3import Styles from '../styles/navbar.module.css'
4
5const ThemeChangeButton = () => {
6 const [colorMode, setColorMode] = useColorMode()
7 return (
8 <header>
9 <a onClick={(e) => {
10 e.preventDefault();
11 setColorMode(colorMode === 'light' ? 'dark' : 'light');
12 }}>
13 <img
14 alt="Theme"
15 className={Styles.icon}
16 src={`/${colorMode}.svg`}
17 /></a>
18 </header>
19 )
20}
21
22export default ThemeChangeButton;