Skip to content

chore: Migrate .less styles to Emotion#22474

Merged
kgabryje merged 22 commits into
apache:masterfrom
kgabryje:chore/less-to-emotion
Jan 19, 2023
Merged

chore: Migrate .less styles to Emotion#22474
kgabryje merged 22 commits into
apache:masterfrom
kgabryje:chore/less-to-emotion

Conversation

@kgabryje
Copy link
Copy Markdown
Member

@kgabryje kgabryje commented Dec 20, 2022

SUMMARY

This PR migrates all .less files that target Dashboard, Explore and SqlLab. Generic stylesheets (for example with antd overrides or global LESS variables) are out of scope

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Test all flows related to Dashboard and SqlLab. Compare with current master - there shouldn't be any meaningful changes, except for small spacing changes here and there (so that the spacings use grid unit from Superset's theme).
Explore shouldn't really be affected by this PR - I removed explore/main.less stylesheet, but it seems that it wasn't even used at all. However, check the Explore page just to be safe.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@kgabryje kgabryje marked this pull request as draft December 20, 2022 18:00
@kgabryje kgabryje force-pushed the chore/less-to-emotion branch from 782ff29 to 5e932f5 Compare December 21, 2022 17:24
@kgabryje kgabryje changed the title [WIP] Migrate .less styles to Emotion Migrate .less styles to Emotion Dec 22, 2022
@kgabryje kgabryje changed the title Migrate .less styles to Emotion chore: Migrate .less styles to Emotion Dec 22, 2022
@kgabryje kgabryje marked this pull request as ready for review December 22, 2022 15:58
@kgabryje kgabryje force-pushed the chore/less-to-emotion branch 3 times, most recently from 3161f6a to 1758863 Compare December 22, 2022 16:40
@kgabryje
Copy link
Copy Markdown
Member Author

kgabryje commented Jan 3, 2023

/testenv up

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 3, 2023

@kgabryje Ephemeral environment spinning up at http://54.202.20.183:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@kgabryje
Copy link
Copy Markdown
Member Author

Thank you for great feedback @michael-s-molina! I addressed all of your comments (including translating "Empty column") except for the one about using theme fonts in Ace Editor. We can do an investigation as a follow up to verify if the comment about buggy Fira font is still valid

Copy link
Copy Markdown
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for all the hard work and for addressing the comments @kgabryje. I would also suggest that you get QA's approval before merging the PR. We could schedule a team review to go through the application to see if we spot any differences as an additional precaution.

@kgabryje
Copy link
Copy Markdown
Member Author

kgabryje commented Jan 10, 2023

CC @AnushaErrabelli for review

@AnushaErrabelli
Copy link
Copy Markdown

LGTM.

Comment on lines +91 to +93
.ant-modal-body {
overflow: auto;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like we might be able to get rid of this one, if I recall correctly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll check!

<ButtonGroup>
<Button
buttonSize="small"
className="m-r-5"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this PR doesn't do it, we can probably do a sweep to get rid of these weird little utility classes soon.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yup, out of scope of this PR

margin-bottom: 10px;
}

.m-l-2 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This probably got yanked in from another file, and i'm lost in the weeds, but just making sure we're not adding more of these utility classes if we don't need to ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, the "global" stylesheets were out of scope of this PR and that .m-l-2 class looked like it belonged here.


/* A row within a column has inset hover menu */
.dragdroppable-column .dragdroppable-row .hover-menu--left {
left: ${theme.gridUnit * -3}px;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this what we'd want if we ever changed the scale of the grid unit? If it just needs to be 1px forever and always, so be it ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point 🤔 We should do a sweep through the styles and verify if some values should be hardcoded rather than be dependent on theme

height: 100%;
top: 0;
left: 0;
z-index: 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At some point, we should bring back a z-index "registry" and centralize all these things values as vars.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

position: relative;

&.dragdroppable--dragging {
opacity: 0.2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The theme contains opacity stops we should leverage wherever it makes sense. It includes 10% and 35% stops at the moment, so maybe we should try one of those here in a separate PR? There are probably random opacities all over we could audit for.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I'll see which fits better 👍

}

&.dragdroppable-column .resizable-container span div {
z-index: 10;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, we should have a z-index registry, so we can think of all of Superset as layers in a consolidated way, do calculations like theme.layers.navigation + 1.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

left: 0;
width: 100%;
height: 100%;
border: 2px solid ${theme.colors.primary.base};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is the first 2px border I've seen in all this. Might be worth checking for consistency.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's this border when component is focused in edit mode. Looks weird with 1px

image

position: absolute;
flex-wrap: nowrap;
left: 1px;
top: -42px;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if these should be in gridUnits, or if it's -42 for a specific reason.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes it should be in gridUnits. It's related to component's height (40px or 10gridUnits)

Comment thread superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
*/
import { css, SupersetTheme } from '@superset-ui/core';

export const headerStyles = (theme: SupersetTheme) => css`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm... I wonder if these are worth moving into (or along side of) the theme itself for global re-use

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously it targeted only Dashboard, so I moved it here in order to reduce the impact and chances of regressions. You're right though that we might want to make it global

Copy link
Copy Markdown
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

This is awesome! I left a few nits/questions/follow-ups for future sweeping, but in general, this seems fantastic! Should we reset the baseline on visual regression tests and make sure this doesn't trigger any alarm bells?

@rusackas
Copy link
Copy Markdown
Member

@kgabryje any reason not to merge this before the inevitable conflicts arise?

@kgabryje kgabryje merged commit 39c96d0 into apache:master Jan 19, 2023
@kgabryje
Copy link
Copy Markdown
Member Author

Good call @rusackas! I'll do a sweep through your comments in a followup PR

@github-actions
Copy link
Copy Markdown
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@mistercrunch mistercrunch added the 🚢 2.1.3 First shipped in 2.1.3 label Feb 18, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 First shipped in 2.1.0 and removed 🚢 2.1.3 First shipped in 2.1.3 labels Mar 13, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XXL 🚢 2.1.0 First shipped in 2.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants