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

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented Aug 23, 2022

Summary

While working on the guided onboarding project, I noticed that when a header section item is empty, it's still rendered with a min-width setting. Instead we only render this component, if it's not empty.

Screenshot before

Screenshot 2022-08-22 at 17 50 40

Checklist

  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6158/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6158/

@@ -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.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6158/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6158/

Copy link
Contributor

@miukimiu miukimiu left a comment

Choose a reason for hiding this comment

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

Thanks, @yuliacech. LGTM! 🎉

I just have one minor suggestion for the CL.

upcoming_changelogs/6158.md Outdated Show resolved Hide resolved
Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>
@yuliacech yuliacech enabled auto-merge (squash) August 25, 2022 09:18
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6158/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants