-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
- requires reaching into internals, as we generally do not want consumers using our styles directly (vs our styled components)
- it's not terrible useful, but that's because it's Enzyme 🤷
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/eui-team (EUI) |
const { euiTheme } = useEuiTheme(); | ||
const { colors, size, border } = euiTheme; | ||
const euiThemeContext = useEuiTheme(); | ||
const { euiButtonDisplay } = euiButtonDisplayStyles(euiThemeContext); |
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.
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.
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.
LGTM. The button looks much better with the new padding!
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11147362892 |
## 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…194621) (#194737) # Backport This will backport the following commits from `main` to `8.x`: - [Replace Sass `@euiButton` 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>
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
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
Checklist