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

[EuiButtonIcon] Add display prop #4466

Merged
merged 24 commits into from
Mar 2, 2021
Merged

Conversation

andreadelrio
Copy link
Contributor

@andreadelrio andreadelrio commented Jan 31, 2021

Summary

  • Added display prop to support two more styles. Options now are: base (similar to default EuiButton), empty and fill (similar to EuiButton with fill).
  • Added size prop to also match that of the other button types

image

Also added a section about how this enable "split" button behaviors.

Screen Shot 2021-02-23 at 18 46 31 PM

Note:

There's an issue happening in Chrome on hover. It seems like the button briefly gains width. Haven't been able to track down more details but seems like it occurs when a button has one element (an svg in this case). Checked other browsers and they behave ok. See:

Screen Recording 2021-01-31 at 11 56 29 AM

UPDATE: This is def a chrome bug and not specific to this PR. Will deal with later.

Checklist

  • Check against all themes for compatibility 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 the any docs examples
  • Added or updated jest tests
    ~- [ ] Checked for breaking changes and labeled appropriately
    - [x] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@andreadelrio andreadelrio requested a review from cchaos January 31, 2021 18:52
@andreadelrio
Copy link
Contributor Author

andreadelrio commented Feb 1, 2021

Related:

Just found that the same issue is also occurring on EuiButton in Discover (Chrome):

Screen Recording 2021-02-01 at 10 42 49 AM

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.

This is great! I'm excited to have more prominent icon-only buttons. One of the main reasons to do this as well is to allow for the idea of split buttons by just using two buttons side-by-side, one that is icon-only but looks the same as our other ones. Like:
Screen Shot 2021-02-02 at 11 44 26 AM

So I'd like to be able to take this a step further and also align the size of the button to match the sizes of our other buttons. For instance, we already weirdly have a size prop that doesn't do anything. 🤷

So let's use that and expand it to include the sizes xs | s | m. The xs size would be the default as it is now 24x24px and would match the EuiButtonEmpty.size = 'xs'.

Screen Shot 2021-02-02 at 11 40 57 AM

Screen Shot 2021-02-02 at 11 41 07 AM

Then size s would start to match the sizing of our normal EuiButton.size="s".

Screen Shot 2021-02-02 at 11 41 12 AM

What I did notice, however, is that the new styles (fill and default) actually increase the overall size of the button to 26x26px because of the border. We would need to accomodate for that border and ensure it still renders at the same overall square size as the empty version.

Screen Shot 2021-02-02 at 11 41 03 AM

@chandlerprall
Copy link
Contributor

This is great, thanks @andreadelrio! Would be nice to find a better name than default for the existing style, or allow an undefined on the prop to not "apply" a style.

@cchaos
Copy link
Contributor

cchaos commented Feb 3, 2021

Oooh I like the undefined idea!

@kibanamachine
Copy link

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

@andreadelrio andreadelrio requested a review from cchaos February 5, 2021 14:06
cchaos
cchaos previously requested changes Feb 5, 2021
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.

Thanks for making those updates! You can probably update the CL entry too now to include the size prop.

Quick pass on the visual design and it all looks right except for the shadows. There's some discrepancies between how the normal buttons behave and the icon buttons.

In the default theme, the fill style has no shadow at all, but it should. Also, the disabled buttons are moving when hovered, but they shouldn't.

Screen Recording 2021-02-05 at 10 53 20 AM

In the Amsterdam theme, the undefined version has a shadow, but shouldn't. We've removed all the shadows from buttons in the Amsterdam theme.

Screen Recording 2021-02-05 at 10 51 57 AM

src/components/button/button_icon/button_icon.tsx Outdated Show resolved Hide resolved
src-docs/src/views/button/button_icon.js Outdated Show resolved Hide resolved
src-docs/src/views/button/button_example.js Outdated Show resolved Hide resolved
@kibanamachine
Copy link

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

cchaos added 4 commits February 23, 2021 16:52
Basically copy/pasted all .euiButton styles.
Created new `$euiButtonHeightXSmall` sass var
@cchaos cchaos self-requested a review February 23, 2021 22:44
@kibanamachine
Copy link

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

@cchaos cchaos requested review from thompsongl and elizabetdev and removed request for cchaos February 23, 2021 23:33
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.

I took this one over so we can have these updates for Amsterdam. Most of the changes are actually snapshots from added classes.

/**
* Set for deprecation 2/26/20
* This color button can easily be confused with disabled, it should not be used
*/
| 'text';
Copy link
Contributor

Choose a reason for hiding this comment

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

I removed this deprecation notice because there are actually cases where the text option is viable

Comment on lines +1 to +2
// This file has lots of modifiers and is somewhat nesty by nature
// sass-lint:disable nesting-depth
Copy link
Contributor

Choose a reason for hiding this comment

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

In this file, I basically copy/pasted directly from the .euiButton styles. I didn't want to accidentally introduce any bugs into the .euiButton styles by trying to make more mixins or such, so that's why I just did a manual copy/paste.

@@ -2,11 +2,10 @@
$euiButtonIconTypes: (
accent: $euiColorAccentText,
danger: $euiColorDangerText,
disabled: $euiButtonColorDisabledText,
Copy link
Contributor

Choose a reason for hiding this comment

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

This wasn't being used in this manner

Comment on lines -10 to +9
text: $euiTextColor,
text: $euiColorDarkShade,
Copy link
Contributor

Choose a reason for hiding this comment

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

The text color of the empty version is manually changed to $euiTextColor in the loop, so this change only affects the fill and base versions.

Comment on lines 46 to 50
/**
* Set for deprecation 2/23/21
* This color button is close enough to text to be duplicative
*/
| 'subdued'
Copy link
Contributor

Choose a reason for hiding this comment

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

This color is too close to both disabled and the text versions of the button so I think we should deprecate it in favor of text.

@cchaos cchaos dismissed their stale review February 23, 2021 23:51

Out of date

@kibanamachine
Copy link

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

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!

src/components/button/button_icon/button_icon.tsx Outdated Show resolved Hide resolved
@kibanamachine
Copy link

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

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

Tested in Chrome, Firefox, Edge, and Safari. LGTM! 🎉

I just have two questions/suggestions.

Should the disabled empty EuiButtonIcon have a hover state? It seems weird to me.

Screen.Recording.2021-03-02.at.04.24.PM.mov

For consistency when we're talking about requiring an aria-label:

Screenshot 2021-03-02 at 16 40 08

Should we use a EuiCallOut instead? Like we're using for other a11y suggestions.

Screenshot 2021-03-02 at 16 41 31

@cchaos
Copy link
Contributor

cchaos commented Mar 2, 2021

Bah! I can't believe I missed that hover state. Good catch! Sure I can also update that doc message to be in a callout.

@kibanamachine
Copy link

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

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.

6 participants