/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shared/src/devtools/views/Components/ForgetBadge.js
50 строк
1 KB
Sebastian "Sebbie" Silbermann
[DevTools] Stop using native `title` for buttons/icons (#34379)
11 сен 2025, 19:49
Не верифицирован
11 сен 2025, 19:49
67415c8
Код
Авторство
О чём код?
/** * 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 Badge from './Badge'; import IndexableDisplayName from './IndexableDisplayName'; import Tooltip from './reach-ui/tooltip'; import styles from './ForgetBadge.css'; type CommonProps = { className?: string, }; type PropsForIndexable = CommonProps & { indexable: true, elementID: number, }; type PropsForNonIndexable = CommonProps & { indexable: false | void, elementID?: number, }; type Props = PropsForIndexable | PropsForNonIndexable; export default function ForgetBadge(props: Props): React.Node { const {className = ''} = props; const innerView = props.indexable ? ( <IndexableDisplayName displayName="Memo" id={props.elementID} /> ) : ( 'Memo' ); const title = '✨ This component has been auto-memoized by the React Compiler.'; return ( <Tooltip label={title}> <Badge className={`${styles.Root} ${className}`}>{innerView}</Badge> </Tooltip> ); }