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

Set min-width on header section items only when they are not empty #6158

Merged
merged 5 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -31,7 +31,7 @@
}

@include euiBreakpoint('xs') {
.euiHeaderSectionItem {
.euiHeaderSectionItem:not(:empty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should check instead in EuiHeaderSectionItem if the component has children, if not it doesn't render at all.

// In "/src/components/header/header_section/header_section_item.tsx" instead of returning:
return (
    <div className={classes} {...rest}>
      {children}
    </div>
  );

// we check if there is a children and if is not, we don't render anything:
return children ? (
    <div className={classes} {...rest}>
      {children}
    </div>
  ) : null;

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to returning null when children isn't present, this will also avoid applying the border styling when no content is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot, @miukimiu! I agree, much better handling of the empty state. Let me apply your suggestion to this PR.

min-width: $euiHeaderChildSize * .75;
}

Expand All @@ -41,4 +41,4 @@
display: none;
}
}
}
}
3 changes: 3 additions & 0 deletions upcoming_changelogs/6158.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Updated the header section item to have `min-width` only when non-empty