-
Notifications
You must be signed in to change notification settings - Fork 841
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
[Amsterdam] Updating button styles #2874
Conversation
Is that screenshot using the current 16px base font size? Will it shrink a little when we switch to 14px? Just curious. It doesn't look bad right now, but I think that 14px base size will be an improvement. |
Just wanted to check if you ran all these through a contrast check? (We want to hit a 5.4:1 ratio between the text and the backgrounds.) |
This is 16px atm. PR for font size changes will come later. |
This one is going to be a bit trickier because we would like avoid as much direct copy/pastes and duplicate styles as possible. It just makes maintenance that much harder. I will pull down this branch and see what kind of solutions I can come up with. It'll probably be a mix of making more mixins and/or breaking apart styles based on purpose. So give me a bit to fiddle with this one. |
- Only showing the Amsterdam callout when they’ve switched to the Amsterdam theme - Added `makeGraphicColor()` SASS color function - Added defaults to `makeHighContrastColor()` SASS color function
- Broke `euiButton()` mixin down to smaller mixins for easier reuse of base styles - Moved `overrides/` folder out of `global_styling` and importing __after__ component imports - Only overriding what __needs__ to/what is __different__
c4aadaf
to
d976768
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
🎉 This one is ready for final review. Please read through the summary first as it should address a few things that might come up. |
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 did a final code review, and it all LGTM 👍
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
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 looks good, buttons look good. Nice work.
I see a break on context menus in the new style where the popover can't calculate a best position. I haven't dug too far into the reason yet, it doesn't look related to this PR. Only happens in the new theme. Does not seem related to this PR because I'm noticing it on the compiled site. Super weird and wondering if it has to do with the dynamic css switch.
Not for this PR, but my guess is we still have some work to do on Focus states for buttons. We do it a little differently (sometimes darken, sometimes lighten, sometimes outline...etc).
The filled, but disabled Ghost buttons seem like they might need a separate check for their text color. Feels like it pops too much for a disabled button.
OMG, thank you for pointing out that it's only in this theme. I kept seeing this error too, but couldn't find a pattern to it. And every time I checked on published docs it was fine (because I never switched from the default theme). I'll see if @chandlerprall can take a look outside of this PR
I'm now setting the text color to be |
@chandlerprall Scratch that request, I've found the root of the problem stemming from an early change the the EuiPanel mixin. I'll be able to push the fix up to this PR. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
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.
Awesome. Thanks for the quick fixes. That disabled ghost button looks much better now.
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
This reverts commit 8575def.
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
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.
Changes LGTM; looked to see if TypeScript could be helpful around that deprecation but didn't find anything
Preview documentation changes for this PR: https://eui.elastic.co/pr_2874/ |
Summary
Updates button styles.
Details
There's some additional files here. Lemme break it down:
mixins/_button.scss
: Modifies current theme'smixins/_button.scss
filevariables/_buttons.scss
: Modifies current theme'svariables/_buttons.scss
fileoverrides/*.scss
: Modifies theEuiButton*
component stylesheet. This is intended as a temporary stop gap until Amsterdam is the default theme. Certain elements like shadows and borders exist in the component code that are to be removed in Amsterdam.Consumers
The default un-filled/hollow buttons in EUI's current theme have been replaced by a filled version that use a subdued variant of the button's assigned color. In most use cases there should be no need to update or modify your existing UIs. For additional information on how/when to use certain button styles, please refer to our Button Guidelines
Follow Ups
Button group styles will be updated in a follow up PR to enhance clarity between default and toggled states.
Dev
In order to support theme overrides that require more than just SASS variable changes, and to avoid duplicating lots of code, several additional steps were taken for the button:
euiButton()
mixin down to smaller mixins for easier reuse of base stylesoverrides/
folder sits outside ofglobal_styling/
and is imported after component importsDisabled styles
There was a lot of manual configuring to create the disabled styles for the different types of buttons. I ended up creating a new variable (in buttons only) called
$euiButtonColorDisabledTextColor
that just calculates the contrast to the 2.0 necessary for disabled elements. This is then used in text portions of disabled buttons that don't have a background. I also then use the same calculation for fill buttons to change the text color to achieve a 2.0 contrast which does mean changing the text color from white to a dark gray:Before
After
Dark mode
But this is a much more sustainable approach when it comes to theming as I was able to remove a lot of overrides for Amsterdam.
Ghost buttons
This PR also has a fix for the current theme's ghost button disabled styles.
Deprecations #1469
text
color EuiButton (and alts)We should really deprecate the
text
color for buttons as it looks too similar to disabled buttons. We can keep it for EuiButtonIcon and EuiButtonEmpty, but the basic buttons shouldn't allow it.disabled
color EuiButton (and alts)It doesn't quite make sense to have a
disabled
color for buttons. Instead we should rely solely on the:disabled
property.Checklist
- [ ] Checked in mobileIE11Edge and Firefox- [ ] Props have proper autodocs- [ ] Added or updated jest tests- [ ] Checked for breaking changes and labeled appropriately