/
anv
/
hackathon
Обзор
Документация
Войти
/
anv
/
hackathon
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/components/Wrapper/Wrapper.tsx
40 строк
1 KB
ANV
add recolor
25 мар 2025, 03:36
25 мар 2025, 03:36
d0c4a6b
Код
Авторство
О чём код?
import React from 'react'; // eslint-disable-next-line @typescript-eslint/no-redeclare import {Button, Icon, Theme, ThemeProvider} from '@gravity-ui/uikit'; import {Moon, Sun} from '@gravity-ui/icons'; import styles from './Wrapper.module.scss'; import {DARK, LIGHT} from '../constants'; export type Props = { children: React.ReactNode; theme: Theme; setTheme: React.Dispatch<React.SetStateAction<Theme>>; }; export const Wrapper: React.FC<Props> = ({children, theme, setTheme}) => { const isDark = theme === DARK; return ( <ThemeProvider theme={theme}> <div className={styles.wrapper}> <div className={styles.themeButton}> <Button selected size="l" view="outlined" onClick={() => { setTheme(isDark ? LIGHT : DARK); }} > <Icon data={isDark ? Sun : Moon} /> </Button> </div> <div className={styles.layout}> <div className={styles.content}>{children}</div> </div> </div> <img src="bear.png" className={styles.image} /> </ThemeProvider> ); };