/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shared/src/devtools/views/Components/ElementBadges.js
53 строки
1 KB
Sebastian Markbåge
[DevTools] Add Badge to Owners and sometimes stack traces (#34106)
07 авг 2025, 17:39
Не верифицирован
07 авг 2025, 17:39
738aebd
Код
Авторство
О чём код?
/** * 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 ForgetBadge from './ForgetBadge'; import styles from './ElementBadges.css'; type Props = { hocDisplayNames: Array<string> | null, environmentName: string | null, compiledWithForget: boolean, className?: string, }; export default function ElementBadges({ compiledWithForget, environmentName, hocDisplayNames, className = '', }: Props): React.Node { if ( !compiledWithForget && (hocDisplayNames == null || hocDisplayNames.length === 0) && environmentName == null ) { return null; } return ( <div className={`${styles.Root} ${className}`}> {compiledWithForget && <ForgetBadge indexable={false} />} {environmentName != null ? <Badge>{environmentName}</Badge> : null} {hocDisplayNames != null && hocDisplayNames.length > 0 && ( <Badge>{hocDisplayNames[0]}</Badge> )} {hocDisplayNames != null && hocDisplayNames.length > 1 && ( <div className={styles.ExtraLabel}>+{hocDisplayNames.length - 1}</div> )} </div> ); }