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

refactor: refactor overlay styling to use css class #4861

Closed

Conversation

malcolm-kee
Copy link
Contributor

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

N/A

Motivation / Use-Case

This PR refactor styling for overlay from inline styles to CSS class, which provides the following benefits:

  • unlocks more CSS features, such as pseudo-selectors
  • make the snapshots more readable, as the snapshots would only show the markup instead of all the CSS styles

Breaking Changes

N/A

Additional Info

This is prepare for better overlay styling that I show in #3689 (comment)

* @param {Document} doc
* @return {CssLoader}
*/
const createCssLoader = (doc) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

css loader could be confusing? Any suggestion is welcome.

@codecov
Copy link

codecov bot commented May 13, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.11 🎉

Comparison is base (874c44b) 90.38% compared to head (415692a) 90.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4861      +/-   ##
==========================================
+ Coverage   90.38%   90.50%   +0.11%     
==========================================
  Files          16       16              
  Lines        1706     1706              
  Branches      649      649              
==========================================
+ Hits         1542     1544       +2     
+ Misses        150      148       -2     
  Partials       14       14              

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -129,12 +142,10 @@ const createOverlay = (options) => {
applyStyle(iframeContainerElement, iframeStyle);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intentionally keep iframe styling to use inline style because we can't scope CSS for it.

css: /* css */ `.webpack-msg-text {
line-height: 1.5;
font-size: 1rem;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lovingly copied from TailwindCSS font-mono: https://tailwindcss.com/docs/font-family

loadedCss.push(css);
}
},
};
Copy link
Member

Choose a reason for hiding this comment

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

It can create a lot of problems. Shorty - we already tried this solution and we had a lot of issues about style tags and its order and overlapping and etc and a lot, so I prefer do not use style and classes at all, I am fine with refactor and move styles in own objects with good names, but using classes again make more problems than benefits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Any issues that was raised before on this? Maybe worth include them in the comments

Copy link
Member

Choose a reason for hiding this comment

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

They were, but they are difficult to find because they are scattered and many headings do not match the original problem, I tried to search for them, but unfortunately I can not find but I remember very well that we had problems with this 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries, tag me when you stumble them then.

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.

2 participants