mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-27 21:00:12 +01:00
34 lines
814 B
JavaScript
34 lines
814 B
JavaScript
import classNames from 'classnames';
|
|
import { Button, Icon } from 'react-basics';
|
|
import useTheme from 'hooks/useTheme';
|
|
import Sun from 'assets/sun.svg';
|
|
import Moon from 'assets/moon.svg';
|
|
import styles from './ThemeSetting.module.css';
|
|
|
|
export function ThemeSetting() {
|
|
const { theme, saveTheme } = useTheme();
|
|
|
|
return (
|
|
<div className={styles.buttons}>
|
|
<Button
|
|
className={classNames({ [styles.active]: theme === 'light' })}
|
|
onClick={() => saveTheme('light')}
|
|
>
|
|
<Icon>
|
|
<Sun />
|
|
</Icon>
|
|
</Button>
|
|
<Button
|
|
className={classNames({ [styles.active]: theme === 'dark' })}
|
|
onClick={() => saveTheme('dark')}
|
|
>
|
|
<Icon>
|
|
<Moon />
|
|
</Icon>
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ThemeSetting;
|