Skip to content

Commit

Permalink
ensure that the numFilters is used properly for the button class
Browse files Browse the repository at this point in the history
  • Loading branch information
pickypg committed Feb 4, 2019
1 parent 486f84d commit d0d2cc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`EuiFilterButton renders zero properly 1`] = `
class="euiButtonEmpty__content"
>
<span
class="euiButtonEmpty__text"
class="euiButtonEmpty__text euiFilterButton__text-hasNotification"
>
<span
class="euiFilterButton__textShift"
Expand Down
6 changes: 4 additions & 2 deletions src/components/filter_group/filter_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export const EuiFilterButton = ({
className,
);

// != instead of !== to allow for null and undefined
const numFiltersDefined = numFilters != null;
const buttonTextClassNames = classNames(
{ 'euiFilterButton__text-hasNotification': numFilters, },
{ 'euiFilterButton__text-hasNotification': numFiltersDefined, },
textProps && textProps.className,
);

Expand All @@ -52,7 +54,7 @@ export const EuiFilterButton = ({
<span className="euiFilterButton__textShift" data-text={children}>
{children}
</span>
{numFilters != null &&
{numFiltersDefined &&
<EuiNotificationBadge className="euiFilterButton__notification">{numFilters}</EuiNotificationBadge>
}
</Fragment>
Expand Down

0 comments on commit d0d2cc0

Please sign in to comment.