Skip to content

Commit

Permalink
fix: adding Marcus' suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
macci001 committed Mar 1, 2025
1 parent be899a3 commit 579fce7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
11 changes: 4 additions & 7 deletions packages/components/toast/src/toast-region.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import type {SlotsToClasses, ToastRegionSlots, ToastRegionVariantProps} from "@heroui/theme";

import {useCallback, useEffect, useMemo, useRef, useState} from "react";
import {useToastRegion, AriaToastRegionProps} from "@react-aria/toast";
import {QueuedToast, ToastState} from "@react-stately/toast";
import {useHover} from "@react-aria/interactions";
import {mergeProps} from "@react-aria/utils";
import {
SlotsToClasses,
toastRegion,
ToastRegionSlots,
ToastRegionVariantProps,
} from "@heroui/theme";
import {toastRegion} from "@heroui/theme";
import {clsx} from "@heroui/shared-utils";

import Toast from "./toast";
Expand Down Expand Up @@ -80,7 +77,7 @@ export function ToastRegion<T extends ToastProps>({
<div
{...mergeProps(regionProps, hoverProps)}
ref={ref}
className={slots.base({class: clsx(baseStyles, classNames?.base)})}
className={slots.base({class: clsx(baseStyles)})}
data-placement={placement}
onTouchStart={handleTouchStart}
>
Expand Down
36 changes: 17 additions & 19 deletions packages/components/toast/stories/toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,34 +232,32 @@ const WithToastFromModalTemplate = (args) => {
return (
<>
<ToastProvider maxVisibleToasts={args.maxVisibleToasts} placement={args.placement} />
<Modal {...args} isOpen={isOpen} scrollBehavior="outside" onOpenChange={onOpenChange}>
<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>
<Button onPress={onClose}>Close</Button>
<div className="flex gap-4">
<Button onPress={onClose}>Close</Button>
<Button
onPress={() => {
addToast({
title: "Toast Title",
description: "Toast Displayed Successfully",
...args,
});
}}
>
Show Toast
</Button>
</div>
</ModalFooter>
</ModalContent>
</Modal>
<div className="flex gap-4">
<div>
<Button onPress={onOpen}>Open Modal</Button>
</div>
<div>
<Button
onPress={() => {
addToast({
title: "Toast Title",
description: "Toast Displayed Successfully",
...args,
});
}}
>
Show Toast
</Button>
</div>
<div className="flex">
<Button onPress={onOpen}>Open Modal</Button>
</div>
</>
);
Expand Down

0 comments on commit 579fce7

Please sign in to comment.