/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shared/src/devtools/views/Profiler/RecordToggle.js
43 строки
1 KB
Jan Kassens
Upgrade prettier (#26081)
31 янв 2023, 16:25
Не верифицирован
31 янв 2023, 16:25
6b30832
Код
Авторство
О чём код?
/** * 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 * as React from 'react'; import {useContext} from 'react'; import Button from '../Button'; import ButtonIcon from '../ButtonIcon'; import {ProfilerContext} from './ProfilerContext'; import styles from './RecordToggle.css'; export type Props = { disabled?: boolean, }; export default function RecordToggle({disabled}: Props): React.Node { const {isProfiling, startProfiling, stopProfiling} = useContext(ProfilerContext); let className = styles.InactiveRecordToggle; if (disabled) { className = styles.DisabledRecordToggle; } else if (isProfiling) { className = styles.ActiveRecordToggle; } return ( <Button className={className} disabled={disabled} onClick={isProfiling ? stopProfiling : startProfiling} testName="ProfilerToggleButton" title={isProfiling ? 'Stop profiling' : 'Start profiling'}> <ButtonIcon type="record" /> </Button> ); }