Skip to content

[Emotion] Converted EuiBeacon - #5814

Merged
elizabetdev merged 18 commits into
elastic:mainfrom
elizabetdev:beacon-emotion
Apr 22, 2022
Merged

elizabetdev merged 18 commits into
elastic:mainfrom
elizabetdev:beacon-emotion

Conversation

@elizabetdev

@elizabetdev elizabetdev commented Apr 19, 2022 •

Copy link
Copy Markdown
Contributor

Summary

This PR converts the EuiBeacon to Emotion.

  • The animation now only runs if prefers-reduced-motion: no-preference.
  • Added a test shouldRenderCustomStyles()

How to test

You can test by comparing the new implementation with the old one.

Beacon:

Beacon in tour component:

Things to look out for when moving styles

  • [ ] Anything in the backlog that could be a quick fix for that component?
  • [ ] Convert global Sass vars to JS version like sizing
  • [ ] Convert component-specific Sass vars to exported JS versions
  • Convert side specific padding, margin, and position to -inline and -block (Logical properties)
  • [ ] Reduce specificity where possible (usually by reducing class name chaining)
  • [ ] Use gap property to add margin between items if using flex
  • [ ] Can any still existing .js files be converted to TS?

QA

  • Do className, css, and style props work properly when passed by the consumer
  • Does the rendered class read as expected

Checklist

  • Checked 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 any docs examples
  • Added or updated jest and cypress tests~
  • [ ] Checked for breaking changes and labeled appropriately
  • [ ] Checked for accessibility including keyboard-only and screenreader modes
  • [ ] Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@elizabetdev elizabetdev changed the title [Draft] Convert EuiBeacon to Emotion [Emotion] Converted EuiBeacon Apr 20, 2022
@elizabetdev
elizabetdev marked this pull request as ready for review April 20, 2022 13:25
<div
aria-label="aria-label"
class="euiBeacon testClass1 testClass2"
class="euiBeacon testClass1 testClass2 css-haebed-euiBeacon-euiCanAnimate-euiBeacon-euiCanAnimate-euiBeacon"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder why this one is outputting -euiBeacon so many times...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tested and it is because of the :before and :after. I also showed it to @chandlerprall and he will take a look while trying to improve the euCanAnimate mixin.

Comment thread src/components/beacon/beacon.styles.ts Resolved
Comment thread src/components/beacon/beacon.styles.ts Resolved
Comment thread src/components/beacon/beacon.styles.ts Resolved
Comment thread src/components/beacon/beacon.test.tsx Resolved
@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@thompsongl thompsongl mentioned this pull request Apr 20, 2022
49 tasks done
@thompsongl

Copy link
Copy Markdown
Contributor

elizabetdev#29 is one idea for fixing euiCanAnimate

@kibanamachine

Copy link
Copy Markdown
Contributor

@elizabetdev
elizabetdev requested a review from cchaos April 21, 2022 12:59

@cchaos cchaos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Love the stopped-motion version. 😍

Comment thread upcoming_changelogs/5814.md Outdated
@@ -0,0 +1,3 @@
**CSS-in-JS conversions**

- Converted `EuiBeacon` to Emotion No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a CL item that says the canAnimate hooks have been changed to a constant?

@kibanamachine

Copy link
Copy Markdown
Contributor

@elizabetdev
elizabetdev merged commit 3c427b1 into elastic:main Apr 22, 2022
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.

5 participants