Skip to content

Commit ba3d8bd

Browse files
Copilothotlong
andcommitted
Fix code review issues: move toaster, fix toast delay, update exports
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 84a8624 commit ba3d8bd

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

packages/components/src/hooks/use-toast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
} from "../ui/toast"
1515

1616
const TOAST_LIMIT = 1
17-
const TOAST_REMOVE_DELAY = 1000000
17+
const TOAST_REMOVE_DELAY = 5000
1818

1919
type ToasterToast = ToastProps & {
2020
id: string

packages/components/src/renderers/feedback/toaster.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
import { ComponentRegistry } from '@object-ui/core';
1010
import type { ToasterSchema } from '@object-ui/types';
11-
import { Toaster as SonnerToaster } from '../../ui';
12-
import { Toaster as DefaultToaster } from '../../ui';
11+
import { Toaster as SonnerToaster } from '../../ui/sonner';
12+
import { ToastNotifier as DefaultToaster } from '../../ui';
1313
// Note: In shadcn/ui typical setup, Toaster is exported from 'components/ui/toaster' and 'components/ui/sonner'.
1414
// But in @object-ui/ui index.tsx, we need to check if they are exported.
1515
// Assuming they are exported as Toaster and Sonner (or similar).

packages/components/src/ui/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export * from './tabs';
6262
export * from './textarea';
6363
export * from './timeline';
6464
export * from './toast';
65+
export { Toaster as ToastNotifier } from './toaster';
6566
export * from './toggle-group';
6667
export * from './toggle';
6768
export * from './tooltip';

packages/components/src/ui/toast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const ToastClose = React.forwardRef<
8686
"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
8787
className
8888
)}
89-
toast-close=""
89+
toast-close
9090
{...props}
9191
>
9292
<X className="h-4 w-4" />
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {
1515
ToastProvider,
1616
ToastTitle,
1717
ToastViewport,
18-
} from "../ui/toast"
19-
import { useToast } from "./use-toast"
18+
} from "./toast"
19+
import { useToast } from "../hooks/use-toast"
2020

2121
export function Toaster() {
2222
const { toasts } = useToast()

0 commit comments

Comments
 (0)