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

Fix responsiveness of EuiFilterGroup #1849

Merged
merged 16 commits into from
Apr 29, 2019
Merged

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Apr 17, 2019

Fixes #1818

Changed up a bit of the styles to allow for better responsiveness of EuiFilterGroup. It required adding an optional prop of fullWidth for better control.

…including the search bar.


Deprecations

I have deprecated the use of noDivider on EuiFilterButtons in favor of a more aptly named prop of withNext in case it's more than just a divider change.

Checklist

  • This was checked in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
  • Jest tests were updated or added to match the most common scenarios
  • [ ] This was checked against keyboard-only and screenreader scenarios
  • [ ] This required updates to Framer X components

@cchaos
Copy link
Contributor Author

cchaos commented Apr 17, 2019

@snide Do you playing with this a bit to see if it suits? Don't look at the code just yet, I have to do cleanup.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Didn't test IE, but this wrap works much better and seems to scale. Small comments below.

@@ -91,21 +91,20 @@ export default class extends Component {
numFilters={items.length}
hasActiveFilters={true}
numActiveFilters={2}
grow={true}
>
Composers
Copy link
Contributor

Choose a reason for hiding this comment

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

Really small. Wonder where we should put title tags on this kind of stuff.

image

I guess we couldn't do it automatically because we never know the contents, and I could see titles on all buttons being annoying, so prolly just something we should add directly on our docs examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think adding title attributes to every filter button would be annoying because they only show on long hovers (unlike tooltips). I do think it's a pattern we need to keep up with: If we use the euiTextTruncate mixin, we must also apply the title attribute.

src/components/filter_group/_filter_button.scss Outdated Show resolved Hide resolved
src/components/filter_group/_filter_group.scss Outdated Show resolved Hide resolved
src/components/filter_group/filter_button.js Outdated Show resolved Hide resolved
@cchaos cchaos changed the title [WIP] Fix responsive filter groups Fix responsiveness of EuiFilterGroup Apr 23, 2019
{numFiltersDefined &&
<EuiNotificationBadge
className="euiFilterButton__notification"
size="m"
aria-label={`${numActiveFilters || numFilters} ${!hasActiveFilters ? 'available' : 'active'} filters`}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chandlerprall Can you help me set this up for localization? There's a few ifs in there that I'm not sure how to deal with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Process: the aria-label value needs to be computed by EuiI18n, so computing the value will be done by a function passed to Eui18n's default prop. Any variables needed to compute the label are passed via values. Eui18n's single child is a render prop (function called to render the actual child content) and is given the computed label as an argument.

      {numFiltersDefined &&
        <EuiI18n
          token="euiFilterButton.filterBadge"
          values={{ count: numActiveFilters || numFilters, hasActiveFilters }}
          default={({ count, hasActiveFilters }) => `${count} ${hasActiveFilters ? 'active' : 'available'} filters`}
        >
          {
            filterBadge => (
              <EuiNotificationBadge
                className="euiFilterButton__notification"
                size="m"
                aria-label={filterBadge}
                color={isDisabled || !hasActiveFilters ? 'subdued' : 'accent'}
              >
                {numActiveFilters || numFilters}
              </EuiNotificationBadge>
            )
          }
        </EuiI18n>
      }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx!

@cchaos cchaos marked this pull request as ready for review April 23, 2019 21:54
@cchaos
Copy link
Contributor Author

cchaos commented Apr 29, 2019

@snide Can I get a final pass on this?

src/components/filter_group/filter_group.tsx Outdated Show resolved Hide resolved
src/components/filter_group/index.d.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Code/TypeScript changes LGTM

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Ran locally. Rechecked the code after last feedback. LGTM.

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.

Search Filter bars are not responsive
3 participants