Skip to content

Commit ad59ddf

Browse files
authored
chore[react-devtools/ui]: fix strict mode badge styles (#30159)
## Summary Just a minor UI fix to strict mode badge layout and component name text overflow ## How did you test this change? | Before | After | | --- | --- | | ![Screenshot 2024-06-30 at 23 35 19](https://github.com/facebook/react/assets/28902667/dbe62322-07f3-4291-808d-ecd2b0fba8cc) | ![Screenshot 2024-06-30 at 23 31 06](https://github.com/facebook/react/assets/28902667/863b2f49-942f-4522-b815-5509a77b3b24)|
1 parent e6783e7 commit ad59ddf

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545
.SelectedComponentName {
4646
flex: 1 1 auto;
4747
overflow: hidden;
48-
text-overflow: ellipsis;
49-
line-height: normal;
48+
display: flex;
49+
padding: 0.25rem 0;
50+
height: 100%;
51+
align-items: flex-end;
5052
}
5153

52-
.Component {
53-
flex: 1 1 auto;
54+
.ComponentName {
5455
color: var(--color-component-name);
5556
font-family: var(--font-family-monospace);
5657
font-size: var(--font-size-monospace-normal);
@@ -60,6 +61,10 @@
6061
max-width: 100%;
6162
}
6263

64+
.StrictModeNonCompliantComponentName {
65+
color: var(--color-console-error-icon);
66+
}
67+
6368
.Loading {
6469
padding: 0.25rem;
6570
color: var(--color-dimmer);
@@ -68,6 +73,7 @@
6873
}
6974

7075
.StrictModeNonCompliant {
71-
margin-right: 0.25rem;
76+
display: inline-flex;
77+
padding: 0.25rem;
7278
color: var(--color-console-error-icon);
73-
}
79+
}

packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ export default function InspectedElementWrapper(_: Props): React.Node {
251251
<div
252252
className={
253253
element.isStrictModeNonCompliant
254-
? styles.StrictModeNonCompliant
255-
: styles.Component
254+
? `${styles.ComponentName} ${styles.StrictModeNonCompliantComponentName}`
255+
: styles.ComponentName
256256
}
257257
title={element.displayName}>
258258
{element.displayName}

0 commit comments

Comments
 (0)