/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shared/src/devtools/views/useThemeStyles.js
28 строк
714 B
Mengdi Chen
[DevTools][BE] move shared types & constants to consolidated locations (#26572)
11 апр 2023, 00:07
Не верифицирован
11 апр 2023, 00:07
451736b
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow */ import {useContext, useMemo} from 'react'; import {SettingsContext} from './Settings/SettingsContext'; import {THEME_STYLES} from '../constants'; const useThemeStyles = (): any => { const {theme, displayDensity, browserTheme} = useContext(SettingsContext); const style = useMemo( () => ({ ...THEME_STYLES[displayDensity], ...THEME_STYLES[theme === 'auto' ? browserTheme : theme], }), [theme, browserTheme, displayDensity], ); return style; }; export default useThemeStyles;