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

Replace Sass @euiButton mixin usage with CSS-in-JS #194621

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Oct 1, 2024

Summary

This PR removes a Sass mixin usage that is shortly to be deprecated/removed from EUI.

I think this somewhat addresses #122594 / #122556 but to be honest I'm not 100% sure what's going on with that meta issue 😅

QA

Before After

Note that the height of the button has changed from prod, but from what I can tell this is actually correct and was previously broken on production. Hover/focus styles should remain the same compared to production.

Checklist

- requires reaching into internals, as we generally do not want consumers using our styles directly (vs our styled components)
@cee-chen cee-chen added EUI v9.0.0 v8.16.0 backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes labels Oct 1, 2024
- it's not terrible useful, but that's because it's Enzyme 🤷
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #82 / serverless observability UI Dataset Quality Flyout overview summary panel should show summary KPIs

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 530 660 +130
maps 1239 1240 +1
total +131

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 473.5KB 651.7KB +178.1KB
maps 3.0MB 3.0MB +7.6KB
total +185.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dashboard 27.7KB 27.8KB +58.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@cee-chen cee-chen marked this pull request as ready for review October 1, 2024 22:09
@cee-chen cee-chen requested review from a team as code owners October 1, 2024 22:09
@elasticmachine
Copy link
Contributor

Pinging @elastic/eui-team (EUI)

const { euiTheme } = useEuiTheme();
const { colors, size, border } = euiTheme;
const euiThemeContext = useEuiTheme();
const { euiButtonDisplay } = euiButtonDisplayStyles(euiThemeContext);
Copy link
Member

Choose a reason for hiding this comment

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

small note: I wanted to understand how this works and inspected the contents of euiButtonDisplay. I found it is an object that has a styles field, which is a string, and looks like this in my JS console:

> euiButtonDisplay.styles
'\n    display: inline-block;\n    appearance: none;\n    cursor: pointer;\n    [object Object];\n    white-space: nowrap;\n    max-inline-size: 100%;;\n    vertical-align: middle;\n   font-weight:500;\n    padding-block: 0;\n    padding-inline: 12px;\n     &:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;'

I confirmed with @cee-chen that the [object Object] portion is not something to be concerned about.

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM. The button looks much better with the new padding!

@cee-chen cee-chen merged commit 9bd0da6 into elastic:main Oct 2, 2024
23 checks passed
@cee-chen cee-chen deleted the eui/remove-button-mixin branch October 2, 2024 16:02
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11147362892

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 2, 2024
## Summary

This PR removes a Sass mixin usage that is shortly to be
deprecated/removed from EUI.

I think this somewhat addresses elastic#122594 / elastic#122556 but to be honest I'm
not 100% sure what's going on with that meta issue 😅

### QA

| Before | After |
|--------|--------|
| <img width="231" alt=""
src="https://github.com/user-attachments/assets/578ea6d8-1dce-4daa-9e3d-e1aac7079ec3">
| <img width="260" alt=""
src="https://github.com/user-attachments/assets/482aa5a1-ed0c-4252-95b0-8b324628cb6c">
|

Note that the height of the button has changed from prod, but from what
I can tell this is actually correct and was previously broken on
production. Hover/focus styles should remain the same compared to
production.

- `yarn storybook shared_ux`
- Go to
http://localhost:9001/?path=/story/button-exit-full-screen-button--exit-full-screen-button

### Checklist

- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

(cherry picked from commit 9bd0da6)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 2, 2024
…194621) (#194737)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Replace Sass &#x60;@euiButton&#x60; mixin usage with CSS-in-JS
(#194621)](#194621)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cee
Chen","email":"549407+cee-chen@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-02T16:02:36Z","message":"Replace
Sass `@euiButton` mixin usage with CSS-in-JS (#194621)\n\n##
Summary\r\n\r\nThis PR removes a Sass mixin usage that is shortly to
be\r\ndeprecated/removed from EUI.\r\n\r\nI think this somewhat
addresses #122594 / #122556 but to be honest I'm\r\nnot 100% sure what's
going on with that meta issue 😅\r\n\r\n### QA\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n| <img width=\"231\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/578ea6d8-1dce-4daa-9e3d-e1aac7079ec3\">\r\n|
<img width=\"260\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/482aa5a1-ed0c-4252-95b0-8b324628cb6c\">\r\n|\r\n\r\nNote
that the height of the button has changed from prod, but from what\r\nI
can tell this is actually correct and was previously broken
on\r\nproduction. Hover/focus styles should remain the same compared
to\r\nproduction.\r\n\r\n- `yarn storybook shared_ux`\r\n- Go
to\r\nhttp://localhost:9001/?path=/story/button-exit-full-screen-button--exit-full-screen-button\r\n\r\n###
Checklist\r\n\r\n- [x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"9bd0da694e7e8851935ac4dcd2b8d76e74fec9f4","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","EUI","v9.0.0","v8.16.0","backport:version"],"title":"Replace
Sass `@euiButton` mixin usage with
CSS-in-JS","number":194621,"url":"https://github.com/elastic/kibana/pull/194621","mergeCommit":{"message":"Replace
Sass `@euiButton` mixin usage with CSS-in-JS (#194621)\n\n##
Summary\r\n\r\nThis PR removes a Sass mixin usage that is shortly to
be\r\ndeprecated/removed from EUI.\r\n\r\nI think this somewhat
addresses #122594 / #122556 but to be honest I'm\r\nnot 100% sure what's
going on with that meta issue 😅\r\n\r\n### QA\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n| <img width=\"231\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/578ea6d8-1dce-4daa-9e3d-e1aac7079ec3\">\r\n|
<img width=\"260\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/482aa5a1-ed0c-4252-95b0-8b324628cb6c\">\r\n|\r\n\r\nNote
that the height of the button has changed from prod, but from what\r\nI
can tell this is actually correct and was previously broken
on\r\nproduction. Hover/focus styles should remain the same compared
to\r\nproduction.\r\n\r\n- `yarn storybook shared_ux`\r\n- Go
to\r\nhttp://localhost:9001/?path=/story/button-exit-full-screen-button--exit-full-screen-button\r\n\r\n###
Checklist\r\n\r\n- [x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"9bd0da694e7e8851935ac4dcd2b8d76e74fec9f4"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194621","number":194621,"mergeCommit":{"message":"Replace
Sass `@euiButton` mixin usage with CSS-in-JS (#194621)\n\n##
Summary\r\n\r\nThis PR removes a Sass mixin usage that is shortly to
be\r\ndeprecated/removed from EUI.\r\n\r\nI think this somewhat
addresses #122594 / #122556 but to be honest I'm\r\nnot 100% sure what's
going on with that meta issue 😅\r\n\r\n### QA\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n| <img width=\"231\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/578ea6d8-1dce-4daa-9e3d-e1aac7079ec3\">\r\n|
<img width=\"260\"
alt=\"\"\r\nsrc=\"https://github.com/user-attachments/assets/482aa5a1-ed0c-4252-95b0-8b324628cb6c\">\r\n|\r\n\r\nNote
that the height of the button has changed from prod, but from what\r\nI
can tell this is actually correct and was previously broken
on\r\nproduction. Hover/focus styles should remain the same compared
to\r\nproduction.\r\n\r\n- `yarn storybook shared_ux`\r\n- Go
to\r\nhttp://localhost:9001/?path=/story/button-exit-full-screen-button--exit-full-screen-button\r\n\r\n###
Checklist\r\n\r\n- [x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"9bd0da694e7e8851935ac4dcd2b8d76e74fec9f4"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels EUI release_note:skip Skip the PR/issue when compiling release notes v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants