This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Fix jumpy action buttons in the editor panel #40
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
shouldn't
wrapperClassName
be an actual class name?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.
And it is. That's why I've introduced
<ClassNames/>
here - this is a special component that provides acss
that actually injects a class name eagerly to the CSSOM and returns it:https://github.com/emotion-js/emotion/blob/dcc72d06ace804330fd285a76c8574f3a89001f9/packages/react/src/class-names.js#L113
This is not the same
css
as the one that can be imported from@emotion/react
. Since we are using Chakra right now I've chosen this solution to stick as much as possible to a single styling solution, instead of mixing both Chakra/Emotion and plain CSS/SCSSThere 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 suppose it'd be easier for theming if we go with this solution. in that case, all we need to tweak is the main Chakra theme + some manual work in the canvas
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.
But I admit the API here is confusing.
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 agree that the API is confusing and is one of the main complaints that we receive for Emotion. It is designed like that for a reason though: render prop can actually render something and, by default, during SSR we render
<style/>
elements inline. This makes SSR of Emotion working out of the box, no special setup etc is required to make it work. We know that not everyone is SSRing but exposing a hook-based API that would not solve all the problems has always seemed less than ideal for us.Usually, this is not that big of a problem in codebases because it's not as common to need access to the actual class name, it's mainly when integrating with external libraries that accept class names in different props than the actual
className
prop (which is the case here, we need to pass this to thewrapperClassName
prop). And those external components can usually just be isolated in the codebase so we don't have to use<ClassNames/>
component too much.There is a chance that React 18 will bring some new kind of an API, specific to CSS injection so maybe we'll be able to get rid of this in Emotion in the future. Time will tell though.
There is also a chance that we'll be able to remove this in our codebase if this gets merged in: suren-atoyan/monaco-react#269