Skip to content

refactor(theming): Fixes to previously migrated components#32845

Merged
mistercrunch merged 12 commits intoapache:template_lessfrom
msyavuz:msyavuz/refactor/decouple-migrated-components
Apr 3, 2025
Merged

refactor(theming): Fixes to previously migrated components#32845
mistercrunch merged 12 commits intoapache:template_lessfrom
msyavuz:msyavuz/refactor/decouple-migrated-components

Conversation

@msyavuz
Copy link
Member

@msyavuz msyavuz commented Mar 25, 2025

SUMMARY

There are some components that were migrated before #31590 that needs checking and small fixes after Ant Design tokens are decoupled from them. This PR aims to provide those fixes.

These components are:

  • Avatar
  • Badge
  • Button
    • Default color is primary which seems better than master
    • tertiary color is different
    • no warning success colors which were available in the old button but unused.
  • Card
  • DatePicker
  • Divider
  • Dropdown
  • Input
  • InputNumber
  • List
  • Menu
    • MainNav hover on already selected item is different.
    • Decision for MainNav: vanilla or current fixed version
  • Modal
  • Tag
  • Progress
    • Slight font size on percent text but vanilla looks fine
  • Popover
    • No visual differences but overlayInnerStyle is deprecated
  • Slider
    • Slightly larger tooltip but it looks fine
  • Steps
    • Line colors are a bit darker on vanilla text is a bit lighter
  • Switch
    • Bit darker color
  • Tooltip

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Changes

MainNav Before:
image

MainNav After:
image

PageHeaderWithActions Before:
image

PageHeaderWithActions After:
image

TESTING INSTRUCTIONS

Visual testing.

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

@korbit-ai
Copy link

korbit-ai bot commented Mar 25, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@msyavuz msyavuz marked this pull request as ready for review April 1, 2025 08:28
@dosubot dosubot bot added the global:theming Related to theming Superset label Apr 1, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Inefficient CSS Transition ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigItem.tsx
superset-frontend/src/components/PageHeaderWithActions/index.tsx
superset-frontend/src/components/Menu/index.tsx
superset-frontend/src/components/Modal/Modal.tsx
superset-frontend/src/components/DropdownContainer/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

bottom: ${theme.sizeUnit / 4}px;
left: 0;
transform: scale(0);
transition: 0.2s all ease-out;

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

What are these extra styles for?

Copy link
Member Author

Choose a reason for hiding this comment

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

I provided some screenshots. These styles are here to simplify the hover effects of MainNav.

maxHeight: `${MAX_HEIGHT}px`,
overflow: showOverflow ? 'auto' : 'visible',
},
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

overlayInnerStyle is deprecated right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

overlayClassName="column-config-popover"
styles={{ body: { width, height } }}
rootClassName="column-config-popover"
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thought might as well change these

opacity: 0;
transform: translateX(-50%);
transition: all ${({ theme }) => theme.motionDurationMid}s;
transition: translate ${({ theme }) => theme.motionDurationMid}s;
Copy link
Contributor

@EnxDev EnxDev Apr 1, 2025

Choose a reason for hiding this comment

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

let's use something like that:

const SomeStyledThing=styled.div`
  ${({ theme }) => css`
    padding: ${theme.sizeUnit * 2}px;	
    border-radius: ${theme.borderRadius}px;
    border: 1px solid ${theme.colorPrimary};
  `}
`;

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we can move the theme top level if we use it in multiple instances

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

opacity: 0;
transform: translateX(-50%);
transition: all ${({ theme }) => theme.motionDurationMid}s;
transition: translate ${({ theme }) => theme.motionDurationMid}s;
Copy link
Member

Choose a reason for hiding this comment

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

Yeah we can move the theme top level if we use it in multiple instances

position: absolute;
width: 100%;
height: 2px;
background-color: ${theme.colors.primary.base};
Copy link
Member

Choose a reason for hiding this comment

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

I believe this is what we don't want right? With this approach there is no control over this style via the theme configuration. Isn't this supposed to be a vanilla feature? https://ant.design/components/menu#menu-demo-horizontal

Copy link
Member

Choose a reason for hiding this comment

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

let's get in the habit of using native antd tokens, in this case maybe colorPrimaryBg since it's a background-color (?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! I think this colorPrimaryBorderHover is a better fit because this is used as a border color of MainNav on hover

transform: translateX(-50%);
transition: all ${({ theme }) => theme.motionDurationMid}s;
transition: translate ${({ theme }) => theme.motionDurationMid}s;
background-color: ${({ theme }) => theme.colorPrimary};
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this background color here? Can't we use vanilla?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right! I can't see the change without this

@mistercrunch
Copy link
Member

I think I broke (and fixed) something on the base branch, you may need to remerge/rebase

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM! merging so we can iterate on template_less

@mistercrunch mistercrunch merged commit 6f73e58 into apache:template_less Apr 3, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

global:theming Related to theming Superset size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants