Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools] Ensure the borders collapse collectly when props are not included #30667

Closed
wants to merge 1 commit into from
Closed
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 @@ -6,3 +6,7 @@
.Root *:not(:first-child) {
margin-left: 0.25rem;
}

.InspectedElementBadgesContainer {
padding: 0.25rem;
}
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

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

But this won't render border-bottom for InspectedElementBadges component, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea it just renders the border as part of the top for everything else. If there's only badges and nothing below it then yea there's no separator but there's also nothing to separate it from.

Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ export default function InspectedElementBadges({
}

return (
<div className={styles.Root}>
{compiledWithForget && <ForgetBadge indexable={false} />}
<div className={styles.InspectedElementBadgesContainer}>
<div className={styles.Root}>
{compiledWithForget && <ForgetBadge indexable={false} />}

{hocDisplayNames !== null &&
hocDisplayNames.map(hocDisplayName => (
<Badge key={hocDisplayName}>{hocDisplayName}</Badge>
))}
{hocDisplayNames !== null &&
hocDisplayNames.map(hocDisplayName => (
<Badge key={hocDisplayName}>{hocDisplayName}</Badge>
))}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ export default function InspectedElementPropsTree({
type === ElementTypeClass || canEditFunctionPropsRenamePaths;

const entries = props != null ? Object.entries(props) : null;
if (entries !== null) {
entries.sort(alphaSortEntries);
if (entries === null) {
// Skip the section for null props.
return null;
}

const isEmpty = entries === null || entries.length === 0;
entries.sort(alphaSortEntries);

const isEmpty = entries.length === 0;

const handleCopy = () => copy(serializeDataForCopy(((props: any): Object)));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.InspectedElementTree {
padding: 0.25rem;
border-top: 1px solid var(--color-border);
}
.InspectedElementTree:first-of-type {
border-top: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
line-height: var(--line-height-data);
}

.InspectedElementBadgesContainer:not(:empty) {
padding: 0.25rem;
border-bottom: 1px solid var(--color-border);
}

.Owner {
border-radius: 0.25rem;
padding: 0.125rem 0.25rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ export default function InspectedElementView({
return (
<Fragment>
<div className={styles.InspectedElement}>
<div className={styles.InspectedElementBadgesContainer}>
<InspectedElementBadges
hocDisplayNames={element.hocDisplayNames}
compiledWithForget={element.compiledWithForget}
/>
</div>
<InspectedElementBadges
hocDisplayNames={element.hocDisplayNames}
compiledWithForget={element.compiledWithForget}
/>

<InspectedElementPropsTree
bridge={bridge}
Expand Down
Loading