-
Notifications
You must be signed in to change notification settings - Fork 842
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
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
There was a problem hiding this 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:
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'
.
Then size s
would start to match the sizing of our normal EuiButton.size="s"
.
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.
This is great, thanks @andreadelrio! Would be nice to find a better name than |
Oooh I like the |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
There was a problem hiding this 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.
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.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
Basically copy/pasted all .euiButton styles. Created new `$euiButtonHeightXSmall` sass var
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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
// This file has lots of modifiers and is somewhat nesty by nature | ||
// sass-lint:disable nesting-depth |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
text: $euiTextColor, | ||
text: $euiColorDarkShade, |
There was a problem hiding this comment.
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.
/** | ||
* Set for deprecation 2/23/21 | ||
* This color button is close enough to text to be duplicative | ||
*/ | ||
| 'subdued' |
There was a problem hiding this comment.
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
.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM!
Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
There was a problem hiding this 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
:
Should we use a EuiCallOut instead? Like we're using for other a11y suggestions.
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. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4466/ |
Summary
display
prop to support two more styles. Options now are:base
(similar to defaultEuiButton
),empty
andfill
(similar toEuiButton
with fill).size
prop to also match that of the other button typesAlso added a section about how this enable "split" button behaviors.
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:
UPDATE: This is def a chrome bug and not specific to this PR. Will deal with later.
Checklist
- [ ] Checked Code Sandbox works for the any docs examples~- [ ] Checked for breaking changes and labeled appropriately
- [x] Checked for accessibility including keyboard-only and screenreader modes