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

[EuiFilterGroup] Add compressed prop #5717

Merged
merged 11 commits into from
Mar 15, 2022

Conversation

elizabetdev
Copy link
Contributor

@elizabetdev elizabetdev commented Mar 14, 2022

Summary

This PR adds a compressed prop to EuiFilterGroup and reduces the size of the EuiFilterButton notification badge. It also closes #5695.

As mentioned in #5695, one of the ways to solve this issue was to inherit the EuiButton prop size in EuiFilterButton. But IMO supporting different sizes could cause some inconsistencies in usage. Consumers could pass one size to one button and other sizes to others. Also passing a size prop to multiple components seems very a repetitive task when we can achieve the same goal by just passing one prop in the parent component.

For this reason, I decided to add a compressed prop in the EuiFilterButton parent component EuiFilterGroup.

Also, the EuiFilterGroup is part of our forms section and I think it makes sense to also support the compressed prop like other form components.

EuiFilterGroup-compressed@2x

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_5717/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Suggestion: How about also decreasing the EuiNotificationBadge size to s when compressed?

src/components/filter_group/filter_group.tsx Outdated Show resolved Hide resolved
src/themes/amsterdam/overrides/_filter_group.scss Outdated Show resolved Hide resolved
Comment on lines 21 to 24
export type EuiFilterButtonProps = Omit<
EuiButtonEmptyProps,
'flush' | 'size'
> & {
Copy link
Contributor

Choose a reason for hiding this comment

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

On thing that I've noticed with our Props tables in the docs is that it spits out the props in the order that we supply them here. So in this case, the custom filter button props will display after all the EuiButtonEmptyProps. Can I make a suggestion and put this after the filter button props?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also removing these props may be considered a breaking change in case users are in fact using this props?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is technically a breaking change

Comment on lines 16 to 20
.euiFilterButton__notification {
line-height: $euiSize;
height: $euiSize;
min-width: $euiSize;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right, because you're not applying a size to the filter button itself, there's no way to set size="s" directly on the notification badge.... 🤔

This is kind of a scary override/customization to maintain.

What if it's just always size="s"? And remove any current overrides to the style. It feels a bit large to begin with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing that I did first was to remove the size="m" and when the .euiFilterGroup:not(.euiFilterGroup--compressed) I was extending the .euiNotificationBadge--medium. But I noticed that we don't use Sass extends regularly so I decided to override. 😬

But just leave the default size="s" looks good to me.

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@elizabetdev
Copy link
Contributor Author

Thanks, @cchaos, and @thompsongl. I went through the review and fixed everything.

@cchaos I also updated the Figma component and added a compressed variant. I already published the changes. The notification badges there were already using the size small.

@kibanamachine
Copy link

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

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Code changes LGTM!

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Just a couple nits, but otherwise LGTM! Thanks for tackling!

src/components/filter_group/filter_button.tsx Outdated Show resolved Hide resolved
src/components/filter_group/filter_group.tsx Outdated Show resolved Hide resolved
@kibanamachine
Copy link

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

@elizabetdev elizabetdev enabled auto-merge (squash) March 15, 2022 20:50
@kibanamachine
Copy link

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

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

Successfully merging this pull request may close these issues.

[EuiFilterButton] Vertical separation line is rounded when size="s"
4 participants