-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Canvas] Switch from style-it to emotion #114393
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
Conversation
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
|
@elasticmachine merge upstream |
This comment was marked as outdated.
This comment was marked as outdated.
|
@elasticmachine merge upstream |
|
@crob611 I was just passing by intrigued by the |
b69f7f0 to
c0c8948
Compare
|
@elasticmachine merge upstream |
|
@markov00 Good catch. Removed that usage and removed style-it package all together. |
|
Hey @crob611, Do you still plan to move forward with this PR? Are there any blockers or it just fell under the radar? |
|
@crob611 in |
|
If a jest snapshot has a component using an emotion with the transform it will be something like I think that this PR is fine without it, and am not sure why I added the transform in the first place, but at some point we likely will need to add some kind of transform that will also output the css inline also? |
|
@crob611 Yeah, that's not great but printing out all the rendered CSS isn't great either in my opinion. It would be ideal if it just printed the variables which were passed so that we can verify that computations in the component are valid, but without including tons of unnecessary and internal implementation details about how style variables are transformed into CSS. Either way, I think that @elastic/eui-design is probably the right team to handle that implementation since they're responsible for the emotion integration. (btw I'm @spalger, I used to use @spenceralger but Github let someone else register it...) |
|
@crob611 Using |
|
@thompsongl, I updated it to use Edit |
|
buildkite test this |
|
@elasticmachine merge upstream |
cqliu1
left a comment
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 👍
I tested by uploading a bunch of old workpads with lots of custom CSS, looking through the pages and page previews, and generating reports. It looks like all the custom styles have been preserved and only apply to the workpad and nested elements.
The only styles that I tested that broke from this change are styles that come from @import statements that were previous allowed with style-it but no longer work with emotion, so things like imported Google fonts are no longer usable in Canvas workpads.
I also loaded up the workpad listed in the #100639, and the problematic element no longer appears outside of the workpad to cover parts of the global top bar.
One bug I did encounter, which doesn't necessarily need to be addressed in this PR, is I uploaded an old workpad (probably from late 6.x, early 7.x) that didn't have a css property on the workpad JSON, and that threw this error from failing the workpad schema validation on upload. It looks like css is a required property when it should probably be optional.

|
@cqliu1 Makes sense that we can fix the loading of older workpads which are missing the |
|
buildkite test this |
|
buildkite test this |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Canvas Sharable Runtime
History
To update your PR or re-run it, just comment with: |
Fixes #100639
This switches from using style-it to using emotion for our CSS on the workpad and workpad elements.
See the linked issue for an example of CSS that style-it would leak that is fixed by this issue.
Also, this removes a few places where workpad.css was being added that was not necessary.
Appreciate any testing of edge cases that you can think of here.