2022-03-01 05:54:32 +01:00
|
|
|
import classNames from 'classnames';
|
2022-12-27 01:57:59 +01:00
|
|
|
import { Button, Icon } from 'react-basics';
|
2022-03-01 05:54:32 +01:00
|
|
|
import useTheme from 'hooks/useTheme';
|
|
|
|
import Sun from 'assets/sun.svg';
|
|
|
|
import Moon from 'assets/moon.svg';
|
|
|
|
import styles from './ThemeSetting.module.css';
|
|
|
|
|
2023-04-21 17:00:42 +02:00
|
|
|
export function ThemeSetting() {
|
2023-05-25 06:40:02 +02:00
|
|
|
const { theme, saveTheme } = useTheme();
|
2022-03-01 05:54:32 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.buttons}>
|
|
|
|
<Button
|
|
|
|
className={classNames({ [styles.active]: theme === 'light' })}
|
2023-05-25 06:40:02 +02:00
|
|
|
onClick={() => saveTheme('light')}
|
2022-12-27 01:57:59 +01:00
|
|
|
>
|
|
|
|
<Icon>
|
|
|
|
<Sun />
|
|
|
|
</Icon>
|
|
|
|
</Button>
|
2022-03-01 05:54:32 +01:00
|
|
|
<Button
|
|
|
|
className={classNames({ [styles.active]: theme === 'dark' })}
|
2023-05-25 06:40:02 +02:00
|
|
|
onClick={() => saveTheme('dark')}
|
2022-12-27 01:57:59 +01:00
|
|
|
>
|
|
|
|
<Icon>
|
|
|
|
<Moon />
|
|
|
|
</Icon>
|
|
|
|
</Button>
|
2022-03-01 05:54:32 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2023-04-21 17:00:42 +02:00
|
|
|
|
|
|
|
export default ThemeSetting;
|