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

Add disabled state to EuiBadge #2440

Merged
merged 7 commits into from
Oct 17, 2019

Conversation

andreadelrio
Copy link
Contributor

@andreadelrio andreadelrio commented Oct 15, 2019

Summary

Added disabled state to EuiBadge. I also added some examples to the docs. This is to cover #2355

image

For the case of badges with onClick events here is the behavior when they're disabled.

a_disabledBadges_onClickEvents

Note: the disabled examples shown on the gif above are not in the docs but I can include them if we think they're needed.

Checklist

  • Checked in dark mode
    - [ ] Checked in mobile
  • Checked in IE11 and Firefox
    - [ ] Props have proper autodocs
  • Added documentation examples
    - [ ] Added or updated jest tests
    - [ ] Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

];

export default () => (
<EuiFlexGroup wrap responsive={false} gutterSize="xs" style={{ width: 300 }}>
{badges.map(badge => (
<EuiFlexItem grow={false} key={badge}>
<EuiBadge color={badge}>{badge}</EuiBadge>
<EuiBadge isDisabled={badge === '#fea27f' ? true : false} color={badge}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like all your docs examples did make it into the PR. I think it's good to have one example, but the others can probably be reverted. I would just make "disabled" another option in the list above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you're still making the custom colored one disabled. Can you instead, append to the list a color specifically called 'disabled'?

src/components/badge/_badge.scss Outdated Show resolved Hide resolved
src/components/badge/_badge.scss Show resolved Hide resolved
src/components/badge/badge.tsx Show resolved Hide resolved
src/components/badge/beta_badge/beta_badge.tsx Outdated Show resolved Hide resolved
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 more items but definitely like the button style. Also, we'll need a test for this new prop as well.

];

export default () => (
<EuiFlexGroup wrap responsive={false} gutterSize="xs" style={{ width: 300 }}>
{badges.map(badge => (
<EuiFlexItem grow={false} key={badge}>
<EuiBadge color={badge}>{badge}</EuiBadge>
<EuiBadge isDisabled={badge === '#fea27f' ? true : false} color={badge}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you're still making the custom colored one disabled. Can you instead, append to the list a color specifically called 'disabled'?

src-docs/src/views/badge/notification_badge.tsx Outdated Show resolved Hide resolved
src/components/badge/_index.scss Outdated Show resolved Hide resolved
src/components/badge/beta_badge/_beta_badge.scss Outdated Show resolved Hide resolved
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.

Great, lgtm! I just had one comment about adding a comment, but then it's good to merge.

@@ -56,6 +56,8 @@ export type EuiBadgeProps = {
*/
color?: IconColor;

isDisabled?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're also overriding the colors passed in here, it might be nice to add a docs comment that expresses that behavior.

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.

2 participants