WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@sm17p
Copy link
Contributor

@sm17p sm17p commented Dec 5, 2025

Part of

In this PR, we migrate the usage of alert.scss file in design.scss to tailwind based component.

Since there were a lot of the components, I've only attached before and after shots of the tricky ones and base variants. Please let me know if you need before/after shots of any to help with the review

Changes

  1. Created Alert + AlertIcon component with tailwind based styling for six variants namely

    • default (gray)
    • success (green)
    • warning (yellow)
    • danger (red)
    • info (blue)
    • accent (pink) (New addition with three usages across codebase)
  2. Alert supports automatic icon rendering using variants + custom icon usage via AlertIcon

  3. Updated ToastAlert (server-components/Alert.tsx) to use the new Alert component while preserving toast behavior

  4. [Bug-Fix] Raised ToastAlert z-index to 100, allowing it to appear above Sheets/Modals

Screenshots of changes from #2181

Payouts Page (variant="warning")

Before After
PayoutsPage-Before
PayoutsPage-After.mov

UTM Link (variant="info") after removing asChild from Alert component

There is a slight increase in size of icon over here because tailwind class usage. Line height has increased because of it from ~1.3 to ~1.4

without-asChild

Shots from previous PR

In all of the comparision videos/image, the tailwind one is below the exisiting scss based Alert

Alert Variants Responsive Showcase (5 existing types - Default/Danger/Info/Success/Warning)

Light Dark
BaseVariants-Bef.Aft-light.mov
BaseVariants-Bef.Aft-dark.mov

ToastAlert

Responsive Showcase (Light + Dark)

ToastAlert-Bef.Aft.mov

Bug fix

Increase z-index to make ToastAlert appear above sheet/modals

Before After
before-z-index-30.mov
after-z-index-100.mov
AINotification-custom-Bef.Aft.mov
BlackFridayDiscountInfo-bef.aft.mov
DiscountsPage-BlackFriday-bef.aft.mov
DiscoverEligibility-bef.aft.mov
ProductNew-Bef.Aft.mov
SettingsTeamCloseButton.undo.position.-bef.after.mov

AI Usage

No AI usage after #2181

Live Stream Disclosure

  • Have attended all four live streams

Copy link
Contributor Author

@sm17p sm17p left a comment

Choose a reason for hiding this comment

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

Left a few comments for changes after #2181

<form ref={formRef}>
{props.payouts_paused_by !== null ? (
<Alert role="status" variant="warning" className="mx-8 mb-12">
<Alert className="m-4 md:m-8" role="status" variant="warning">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing margins over here

Before After
PayoutsPage-Before
PayoutsPage-After.mov

Comment on lines 1891 to 1900
<div>
<Alert asChild role="status" variant="info">
<small>
<span>
This sale was driven by a{" "}
<a href={link.utm_url} target="_blank" rel="noreferrer">
UTM link
</a>
.
</span>
</small>
<Alert className="flex-1 text-sm" role="status" variant="info">
<span>
This sale was driven by a{" "}
<a href={link.utm_url} target="_blank" rel="noreferrer">
UTM link
</a>
.
</span>
</Alert>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first one is before and second one is after. Slight increase in icon size over here

without-asChild

Comment on lines +66 to +71
export const AlertIcon = React.forwardRef<HTMLSpanElement, AlertIconProps>(({ children, className, ...props }, ref) => (
<span ref={ref} className={classNames(className)} {...props}>
{children}
</span>
));
AlertIcon.displayName = "AlertIcon";
Copy link
Contributor Author

@sm17p sm17p Dec 5, 2025

Choose a reason for hiding this comment

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

After #2181 (comment), I've removed the default icon override case and context/provider usage.

However, we still needed a way to insert custom icon for variant="accent" and for that the following two options came to my mind

// Custom icon as a prop
<Alert variant="accent" icon={<img src={hands} className="size-12 self-center" alt="" />}>
  <div>Content</div>
</Alert>

// or

// Shadcn/radix style composition pattern
<Alert variant="accent">
  <AlertIcon className="self-center">
    <img src={hands} className="size-12" />
  </AlertIcon>
  <div>Content</div>
</Alert>

I'm just slightly leaned towards radix style composition pattern because other base components are built using it and someone would expect Alert to work similarly.

No strong preference though, have used both patterns across various projects and both tend to do well in the long term

@sm17p sm17p marked this pull request as ready for review December 5, 2025 11:18
@sm17p
Copy link
Contributor Author

sm17p commented Dec 5, 2025

@binary-koan I've addresed some of the review comments please have a look

Also, left a few comments on #2181 which might need some action

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.

3 participants