Skip to content

refactor(IconButton): Refactor IconButton to use Ant Design 5 Card#32876

Closed
fardin-developer wants to merge 4 commits intoapache:masterfrom
fardin-developer:refactor/ant-card-replace-iconbutton
Closed

refactor(IconButton): Refactor IconButton to use Ant Design 5 Card#32876
fardin-developer wants to merge 4 commits intoapache:masterfrom
fardin-developer:refactor/ant-card-replace-iconbutton

Conversation

@fardin-developer
Copy link
Contributor

Fixes: #32823

SUMMARY

This PR removes the non-standard IconButton component and replaces it with the standard Card component from Ant Design 5, as part of the migration effort. The component is currently used in the Database modal.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

CHANGES

  • Removed src/components/IconButton component.
  • Updated all instances to use Ant Design 5's Card component instead.
  • Ensured proper styling with minimal custom overrides.
  • Maintained RTL support and existing behavior.

BEFORE/AFTER SCREENSHOTS

Before

image

After

image

ADDITIONAL NOTES

  • Ensured Storybook coverage for Card usage.
  • Verified that the component works correctly in all relevant UI flows.

CHECKLIST

  • Used Ant Design 5 Card component.
  • Removed unnecessary custom styles.
  • Added Storybook documentation.
  • Verified RTL compatibility.
  • Labeled the PR with frontend:refactor:antd5.

@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor:antd5 labels Mar 27, 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 Memoize Icon Rendering Function ▹ view 🧠 Incorrect
Functionality Incomplete CustomOnClick story implementation ▹ view 🧠 Not in scope
Documentation Missing disabled state behavior description ▹ view 🧠 Not in standard
Readability Hardcoded Icon Paths ▹ view 🧠 Not in scope
Files scanned
File Path Reviewed
superset-frontend/src/components/IconButton/IconButton.stories.tsx
superset-frontend/src/components/IconButton/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

Comment on lines +79 to 84
export const Disabled: Story = {
args: {
buttonText: 'Disabled IconButton',
icon: '/images/icons/sql.svg',
},
};

This comment was marked as resolved.

Comment on lines +29 to +34
options: [
'/images/icons/sql.svg',
'/images/icons/server.svg',
'/images/icons/image.svg',
null,
],

This comment was marked as resolved.

Comment on lines +72 to +77
export const CustomOnClick: Story = {
args: {
buttonText: 'Clickable IconButton',
icon: '/images/icons/image.svg',
},
};

This comment was marked as resolved.

Comment on lines +35 to 48
const renderIcon = () => {
if (icon) {
return (
<img
src={icon}
alt={altText || buttonText}
style={{
width: '100%',
height: '120px',
objectFit: 'contain',
}}
/>
);
}

This comment was marked as resolved.

@msyavuz
Copy link
Member

msyavuz commented Mar 27, 2025

Don't we lose keyboard navigation with this?

@geido
Copy link
Member

geido commented Mar 27, 2025

Don't we lose keyboard navigation with this?

That is a good point. @fardin-developer can we make sure these cards can respond to keyboard navigation as well (tabbing and pressing enter)?

@fardin-developer
Copy link
Contributor Author

fardin-developer commented Mar 27, 2025 via email

@justinpark justinpark requested review from geido and justinpark March 27, 2025 17:24
@fardin-developer
Copy link
Contributor Author

I tested it locally using npm run test and all test cases passed. However, it is still showing as failed here.

Screenshot 2025-03-28 at 12 17 45 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove non-standard IconButton in favor of Ant Design 5 standard Card component

3 participants