Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ import styles from './Badge.css';
type Props = {
className?: string,
children: React$Node,
...
};

export default function Badge({className = '', children}: Props): React.Node {
return <div className={`${styles.Badge} ${className}`}>{children}</div>;
export default function Badge({
className = '',
children,
...props
}: Props): React.Node {
return (
<div {...props} className={`${styles.Badge} ${className}`}>
{children}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {Element as ElementType} from 'react-devtools-shared/src/frontend/ty
import styles from './Element.css';
import Icon from '../Icon';
import {useChangeOwnerAction} from './OwnersListContext';
import Tooltip from './reach-ui/tooltip';

type Props = {
data: ItemData,
Expand Down Expand Up @@ -231,15 +232,16 @@ export default function Element({data, index, style}: Props): React.Node {
/>
)}
{showStrictModeBadge && (
<Icon
className={
isSelected && treeFocused
? styles.StrictModeContrast
: styles.StrictMode
}
title="This component is not running in StrictMode."
type="strict-mode-non-compliant"
/>
<Tooltip label="This component is not running in StrictMode.">
<Icon
className={
isSelected && treeFocused
? styles.StrictModeContrast
: styles.StrictMode
}
type="strict-mode-non-compliant"
/>
</Tooltip>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,3 @@
position: absolute;
right: 0.25em;
}

.ForgetToggle {
display: flex;
}

.ForgetToggle > span { /* targets .ToggleContent */
padding: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as React from 'react';

import Badge from './Badge';
import IndexableDisplayName from './IndexableDisplayName';
import Toggle from '../Toggle';
import Tooltip from './reach-ui/tooltip';

import styles from './ForgetBadge.css';

Expand Down Expand Up @@ -40,12 +40,11 @@ export default function ForgetBadge(props: Props): React.Node {
'Memo'
);

const onChange = () => {};
const title =
'✨ This component has been auto-memoized by the React Compiler.';
return (
<Toggle onChange={onChange} className={styles.ForgetToggle} title={title}>
<Tooltip label={title}>
<Badge className={`${styles.Root} ${className}`}>{innerView}</Badge>
</Toggle>
</Tooltip>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import InspectedElementViewSourceButton from './InspectedElementViewSourceButton
import useEditorURL from '../useEditorURL';

import styles from './InspectedElement.css';
import Tooltip from './reach-ui/tooltip';

export type Props = {};

Expand Down Expand Up @@ -192,14 +193,15 @@ export default function InspectedElementWrapper(_: Props): React.Node {
let strictModeBadge = null;
if (element.isStrictModeNonCompliant) {
strictModeBadge = (
<a
className={styles.StrictModeNonCompliant}
href="https://react.dev/reference/react/StrictMode"
rel="noopener noreferrer"
target="_blank"
title="This component is not running in StrictMode. Click to learn more.">
<Icon type="strict-mode-non-compliant" />
</a>
<Tooltip label="This component is not running in StrictMode. Click to learn more.">
<a
className={styles.StrictModeNonCompliant}
href="https://react.dev/reference/react/StrictMode"
rel="noopener noreferrer"
target="_blank">
<Icon type="strict-mode-non-compliant" />
</a>
</Tooltip>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.Toggle {
display: flex;
}

.Toggle > span { /* targets .ToggleContent */
padding: 0;
}

.Badge {
cursor: help;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@
import * as React from 'react';

import Badge from './Badge';
import Toggle from '../Toggle';
import Tooltip from './reach-ui/tooltip';

import styles from './NativeTagBadge.css';

type Props = {
nativeTag: number,
};

const noop = () => {};
const title =
'Unique identifier for the corresponding native component. React Native only.';

export default function NativeTagBadge({nativeTag}: Props): React.Node {
return (
<Toggle onChange={noop} className={styles.Toggle} title={title}>
<Tooltip label={title}>
<Badge className={styles.Badge}>Tag {nativeTag}</Badge>
</Toggle>
</Tooltip>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ export default function ReportNewIssue({
className={styles.ReportLink}
href={bugURL}
rel="noopener noreferrer"
target="_blank"
title="Report bug">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant title. You already have text telling you what this link is doing.

target="_blank">
Report this issue
</a>
<div className={styles.ReproSteps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export default function WorkplaceGroup(): React.Node {
className={styles.ReportLink}
href={REACT_DEVTOOLS_WORKPLACE_URL}
rel="noopener noreferrer"
target="_blank"
title="Report bug">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant title. You already have text telling you what this link is doing.

target="_blank">
Report this on Workplace
</a>
<div className={styles.FacebookOnly}>(Facebook employees only.)</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/react-devtools-shared/src/devtools/views/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ type Props = {
className?: string,
title?: string,
type: IconType,
...
};

export default function Icon({
className = '',
title = '',
type,
...props
}: Props): React.Node {
let pathData = null;
let viewBox = '0 0 24 24';
Expand Down Expand Up @@ -102,6 +104,7 @@ export default function Icon({

return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
className={`${styles.Icon} ${className}`}
width="24"
Expand Down
Loading