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

fix(toast): Fixing Spinner and renaming the loadingIcon to loadingComponent #4919

Open
wants to merge 8 commits into
base: canary
Choose a base branch
from

Conversation

macci001
Copy link
Contributor

@macci001 macci001 commented Feb 24, 2025

Closes #4898

📝 Description

⛳️ Current behavior (updates)

🚀 New behavior

💣 Is this a breaking change (Yes/No):

Yes
This is an breaking change as loadingIcon prop is renamed to loadingComponent prop

📝 Additional Information

Summary by CodeRabbit

  • Documentation
    • Updated the Toast component documentation with improved descriptions for its loading state.
  • New Features
    • Added a new Toast example that demonstrates a custom spinner for enhanced loading visualization.
  • Refactor
    • Standardized the naming convention for loading indicators in Toast notifications to improve clarity.
  • Chores
    • Applied dependency updates and improvements to spinner functionality.

Copy link

changeset-bot bot commented Feb 24, 2025

🦋 Changeset detected

Latest commit: 1519c00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@heroui/toast Patch
@heroui/theme Patch
@heroui/react Patch
@heroui/autocomplete Patch
@heroui/checkbox Patch
@heroui/date-input Patch
@heroui/date-picker Patch
@heroui/form Patch
@heroui/input-otp Patch
@heroui/input Patch
@heroui/number-input Patch
@heroui/radio Patch
@heroui/select Patch
@heroui/table Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
heroui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2025 2:21pm
heroui-sb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2025 2:21pm

Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

Walkthrough

This pull request consistently renames the loadingIcon attribute to loadingComponent across the codebase. The change updates documentation, interface definitions, component properties, method names, and type signatures in the Toast component. Additionally, a new story export introduces a custom loading component, and a changeset documents the corresponding dependency update and spinner fix.

Changes

File(s) Change Summary
apps/docs/.../toast.mdx, packages/components/toast/src/toast.tsx, packages/components/toast/src/use-toast.ts, packages/core/.../toast.ts, .changeset/soft-weeks-sell.md Renamed all occurrences of loadingIcon to loadingComponent in documentation text, component props, hook interfaces, method signatures, slot definitions, and release notes.
packages/components/toast/stories/toast.stories.tsx Added a new export (PromiseWithCustomLoadingComponent) that renders PromiseToastTemplate with a custom <Spinner variant="spinner" /> as the loading component.

Possibly related PRs

Suggested labels

📦 Scope : Components, 📋 Scope : Docs

Suggested reviewers

  • jrgarciadev
  • wingkwong

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1d763e and 1519c00.

📒 Files selected for processing (4)
  • .changeset/soft-weeks-sell.md (1 hunks)
  • apps/docs/content/docs/components/toast.mdx (3 hunks)
  • packages/components/toast/stories/toast.stories.tsx (2 hunks)
  • packages/core/theme/src/components/toast.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/soft-weeks-sell.md
  • packages/core/theme/src/components/toast.ts
  • packages/components/toast/stories/toast.stories.tsx
  • apps/docs/content/docs/components/toast.mdx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: TypeScript
  • GitHub Check: Continuous Release
  • GitHub Check: Build

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@macci001 macci001 changed the title fix(toast): fix(toast): toast should be above modal and renaming the loadingIcon to loadingComponent Feb 24, 2025
@macci001 macci001 added 📦 Scope : Components Related to the components and removed 📦 Scope : Components Related to the components labels Feb 24, 2025
@macci001 macci001 force-pushed the macci001/fix-toast-issues branch from e9d9d05 to 58544da Compare February 24, 2025 11:43
Copy link

pkg-pr-new bot commented Feb 24, 2025

Open in Stackblitz

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@4919

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@4919

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@4919

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@4919

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@4919

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@4919

@heroui/button

npm i https://pkg.pr.new/@heroui/button@4919

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@4919

@heroui/card

npm i https://pkg.pr.new/@heroui/card@4919

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@4919

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@4919

@heroui/code

npm i https://pkg.pr.new/@heroui/code@4919

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@4919

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@4919

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@4919

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@4919

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@4919

@heroui/form

npm i https://pkg.pr.new/@heroui/form@4919

@heroui/image

npm i https://pkg.pr.new/@heroui/image@4919

@heroui/input

npm i https://pkg.pr.new/@heroui/input@4919

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@4919

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@4919

@heroui/link

npm i https://pkg.pr.new/@heroui/link@4919

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@4919

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@4919

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@4919

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@4919

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@4919

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@4919

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@4919

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@4919

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@4919

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@4919

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@4919

@heroui/select

npm i https://pkg.pr.new/@heroui/select@4919

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@4919

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@4919

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@4919

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@4919

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@4919

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@4919

@heroui/table

npm i https://pkg.pr.new/@heroui/table@4919

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@4919

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@4919

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@4919

@heroui/user

npm i https://pkg.pr.new/@heroui/user@4919

@heroui/react

npm i https://pkg.pr.new/@heroui/react@4919

@heroui/system

npm i https://pkg.pr.new/@heroui/system@4919

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@4919

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@4919

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@4919

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@4919

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@4919

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@4919

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@4919

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@4919

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@4919

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@4919

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@4919

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@4919

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@4919

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@4919

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@4919

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@4919

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@4919

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@4919

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@4919

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@4919

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@4919

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@4919

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@4919

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@4919

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@4919

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@4919

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@4919

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@4919

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@4919

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@4919

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@4919

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@4919

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@4919

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@4919

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@4919

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@4919

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@4919

commit: 1519c00

@macci001 macci001 force-pushed the macci001/fix-toast-issues branch from fbb05b6 to 1b61b94 Compare February 28, 2025 15:44
@macci001 macci001 force-pushed the macci001/fix-toast-issues branch from 260a349 to be899a3 Compare February 28, 2025 15:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/docs/content/docs/components/toast.mdx (1)

183-183: Grammar issue in accessibility section

There's a small grammatical error in the accessibility section.

-All Toasts are present in `ToastRegion`.
+All Toasts are present in the `ToastRegion`.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~183-~183: You might be missing the article “the” here.
Context: ... of alert - All Toasts are present in ToastRegion. - Close button has aria-la...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fbb05b6 and be899a3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .changeset/popular-forks-sparkle.md (1 hunks)
  • apps/docs/content/docs/components/toast.mdx (5 hunks)
  • packages/components/toast/package.json (1 hunks)
  • packages/components/toast/src/toast-provider.tsx (5 hunks)
  • packages/components/toast/src/toast-region.tsx (4 hunks)
  • packages/components/toast/src/toast.tsx (3 hunks)
  • packages/components/toast/src/use-toast.ts (6 hunks)
  • packages/components/toast/stories/toast.stories.tsx (4 hunks)
  • packages/core/theme/src/components/toast.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/components/toast/package.json
  • .changeset/popular-forks-sparkle.md
  • packages/core/theme/src/components/toast.ts
  • packages/components/toast/src/use-toast.ts
  • packages/components/toast/src/toast.tsx
  • packages/components/toast/src/toast-provider.tsx
🧰 Additional context used
🪛 LanguageTool
apps/docs/content/docs/components/toast.mdx

[uncategorized] ~183-~183: You might be missing the article “the” here.
Context: ... of alert - All Toasts are present in ToastRegion. - Close button has aria-la...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: TypeScript
  • GitHub Check: Continuous Release
  • GitHub Check: Build
🔇 Additional comments (13)
packages/components/toast/src/toast-region.tsx (4)

17-20: Good addition of the RegionProps interface

The new RegionProps interface provides a clean way to add className customization capabilities to the toast region, following component design best practices.


22-22: Clean interface extension approach

Extending ToastRegionProps with RegionProps is a good approach that maintains backward compatibility while adding new functionality.


37-38: Props correctly added to component parameter list

The new className and classNames props are properly destructured from the props object.


57-58: Properly combining class names with clsx

Using clsx to combine the className and classNames.base is the right approach.

packages/components/toast/stories/toast.stories.tsx (4)

229-266: Great example of toast with modal integration

This is an excellent example demonstrating how to use toasts from within a modal. This directly addresses the PR objective of ensuring toast appears above modal components.


439-445: Example of custom loading component

This is a good example showing how to use the new loadingComponent prop with a custom Spinner component.

This reflects the breaking change from loadingIcon to loadingComponent mentioned in the PR objectives.


468-473: New story export for toast with modal

The new export complements the template defined earlier, providing a complete example.


5-13:

❓ Verification inconclusive

New dependencies added for modal functionality

The addition of Modal components and Spinner makes sense for the new story examples.

Please ensure these dependencies are properly added to the package.json file.


🏁 Script executed:

#!/bin/bash
# Check if modal and spinner packages are included in dependencies
grep -E "\"@heroui/(modal|spinner)\"" package.json

Length of output: 50


Action Required: Manually Verify Dependency Entries in package.json

The new Modal and Spinner components in the toast story look good, but the automated check did not find any entries for @heroui/modal and @heroui/spinner in package.json. Since the grep command showed no output, please manually verify that these dependencies (or devDependencies) are properly added to package.json. If they are missing, add them accordingly.

apps/docs/content/docs/components/toast.mdx (5)

171-171: Updated slot documentation for loadingComponent

The documentation has been properly updated to reflect the renaming from loadingIcon to loadingComponent.


256-259: Updated API prop documentation

The documentation has been properly updated to reflect the renaming from loadingIcon to loadingComponent.


287-287: Updated type definition for classNames

The type definition for classNames has been updated to include loadingComponent instead of loadingIcon.


334-339: New regionProps property documentation

The documentation for the new regionProps property is clear and concise.


343-354: New ToastRegion Props section

The addition of a dedicated section for ToastRegion Props provides comprehensive documentation for the new styling capabilities.

@wingkwong wingkwong added the 💥 Type: Breaking Change This PR includes breaking changes label Mar 1, 2025
Copy link
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

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

How to press Show Toast when the modal is open? It will close the modal.

image

Copy link
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

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

Please also include an example for drawer in the same story. The name can be changed to "With Overlay".

@macci001
Copy link
Contributor Author

macci001 commented Mar 3, 2025

@wingkwong added your suggestion in latest commit.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/components/toast/stories/toast.stories.tsx (2)

230-290: Enhance the WithToastFromOverlayTemplate with proper type safety.

The template lacks proper typing for the args parameter, which could lead to type-related issues. Also, be careful about spreading args directly to both toast and overlay components as noted in previous comments.

Consider adding proper typing and separating the props:

- const WithToastFromOverlayTemplate = (args) => {
+ const WithToastFromOverlayTemplate = (args: ToastProps & { defaultOpen?: boolean }) => {
  const {isOpen, onOpen, onOpenChange, onClose} = useDisclosure();
  const {
    isOpen: isDrawerOpen,
    onOpen: onDrawerOpen,
    onOpenChange: onDrawerOpenChange,
  } = useDisclosure({defaultOpen: args.defaultOpen});

+  // Extract toast-specific props to avoid passing unrelated props
+  const toastProps = {
+    title: args.title,
+    description: args.description,
+    color: args.color,
+    variant: args.variant,
+    size: args.size,
+    radius: args.radius,
+    shadow: args.shadow,
+    hideIcon: args.hideIcon,
+    hideCloseButton: args.hideCloseButton,
+    timeout: args.timeout,
+    shouldShowTimeoutProgress: args.shouldShowTimeoutProgress,
+  };

  return (
    <>
      <ToastProvider maxVisibleToasts={args.maxVisibleToasts} placement={args.placement} />

      <Modal isOpen={isOpen} scrollBehavior="outside" onOpenChange={onOpenChange}>
        <ModalContent>
          <ModalHeader>Toast from Modal</ModalHeader>
          <ModalBody>
            <div>Press &quot;Show Toast&quot; to launch a toast.</div>
          </ModalBody>
          <ModalFooter>
            <div className="flex gap-4">
              <Button
                onPress={() => {
                  addToast({
                    title: "Toast from modal",
                    description: "Toast Displayed Successfully",
-                   ...args,
+                   ...toastProps,
                  });
                }}
              >
                Show Toast
              </Button>
              <Button onPress={onClose}>Close</Button>
            </div>
          </ModalFooter>
        </ModalContent>
      </Modal>

      <Drawer isOpen={isDrawerOpen} onOpenChange={onDrawerOpenChange}>
        <DrawerContent className="p-4">
          <Button
            className="w-fit"
            onPress={() => {
              addToast({
                title: "Toast from drawer",
                description: "Toast Displayed Successfully",
-               ...args,
+               ...toastProps,
              });
            }}
          >
            Show Toast
          </Button>
        </DrawerContent>
      </Drawer>

      <div className="flex gap-x-2">
        <Button onPress={onOpen}>Open Modal</Button>
        <Button onPress={onDrawerOpen}>Open Drawer</Button>
      </div>
    </>
  );
};

240-240: Consider adding regionProps to the ToastProvider.

Since the PR introduces a new optional regionProps property to the ToastProvider, you could showcase it in this template to demonstrate the new functionality.

- <ToastProvider maxVisibleToasts={args.maxVisibleToasts} placement={args.placement} />
+ <ToastProvider 
+   maxVisibleToasts={args.maxVisibleToasts} 
+   placement={args.placement}
+   regionProps={{
+     className: "z-[10000]" // Ensure toast appears above modals
+   }} 
+ />
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18dbfdc and 20dd898.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/components/toast/package.json (1 hunks)
  • packages/components/toast/stories/toast.stories.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/toast/package.json
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: TypeScript
  • GitHub Check: Continuous Release
  • GitHub Check: Build
🔇 Additional comments (3)
packages/components/toast/stories/toast.stories.tsx (3)

5-14: Good addition of imports for overlay components.

The new imports from Modal, Drawer, and Spinner components support the new overlay-related toast functionality, which aligns with the PR objective of ensuring toast appears above modals.


463-469: Excellent implementation of the renamed loadingComponent prop.

This new export demonstrates the renamed property functionality, transitioning from loadingIcon to loadingComponent as specified in the PR objectives. Using a Spinner component shows the improved flexibility of this approach.


492-497: Good addition of the ToastFromOverlay export.

This export provides a useful example of how toast components can be displayed from within modal and drawer overlays, directly addressing the PR's primary objective of ensuring toasts appear above modals.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/components/toast/stories/toast.stories.tsx (1)

229-266: ⚠️ Potential issue

Props spreading issue in Modal component.

The Modal component is receiving all the args props which are intended for Toast components. This could cause unintended behavior or console warnings about unrecognized props.

Apply this fix to only pass Modal-specific props to the Modal component:

-      <Modal {...args} isOpen={isOpen} scrollBehavior="outside" onOpenChange={onOpenChange}>
+      <Modal isOpen={isOpen} scrollBehavior="outside" onOpenChange={onOpenChange}>
🧹 Nitpick comments (1)
packages/components/toast/stories/toast.stories.tsx (1)

229-229: Add type annotation to the template function.

The template function is missing TypeScript type annotation for better type safety and developer experience.

-const WithToastFromModalTemplate = (args) => {
+const WithToastFromModalTemplate = (args: ToastProps) => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20dd898 and e1d763e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/soft-weeks-sell.md (1 hunks)
  • apps/docs/content/docs/components/toast.mdx (3 hunks)
  • packages/components/toast/package.json (1 hunks)
  • packages/components/toast/src/toast-provider.tsx (1 hunks)
  • packages/components/toast/stories/toast.stories.tsx (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/soft-weeks-sell.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/components/toast/src/toast-provider.tsx
  • apps/docs/content/docs/components/toast.mdx
🔇 Additional comments (4)
packages/components/toast/package.json (1)

59-59: New dependency added to support modal functionality.

The addition of @heroui/modal as a development dependency aligns with the changes in the stories file that now includes a modal example to demonstrate toast behavior above modals.

packages/components/toast/stories/toast.stories.tsx (3)

5-13: Appropriate imports for the new functionality.

The added imports for Modal components, useDisclosure hook, and Spinner are necessary to support the new stories that demonstrate toast behavior with modals and custom loading components.


439-445: Good implementation of the renamed loadingComponent prop.

This story correctly demonstrates the use of the renamed loadingComponent prop (previously loadingIcon), which was one of the main objectives of this PR. The Spinner component is appropriately passed as the loading component.


468-473: New story for demonstrating toast above modal.

This new story helps demonstrate that toasts appear above modals, which addresses the first objective of the PR. Make sure to update the Modal component as suggested in the previous comment to avoid passing unintended props.

@macci001 macci001 force-pushed the macci001/fix-toast-issues branch from e1d763e to 1519c00 Compare March 8, 2025 14:17
@macci001 macci001 changed the title fix(toast): toast should be above modal and renaming the loadingIcon to loadingComponent fix(toast): Fixing Spinner and renaming the loadingIcon to loadingComponent Mar 8, 2025
@wingkwong wingkwong modified the milestones: v2.7.5, v2.8.0 Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💥 Type: Breaking Change This PR includes breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Toast is hidden under drawer / modal
2 participants