[新增] 集成 Sonner 通知库,添加 Toaster 组件并在 InlineMessage 中使用

This commit is contained in:
ryan
2026-06-01 10:41:54 +08:00
parent f034b73a47
commit 65f899d334
15 changed files with 1775 additions and 4792 deletions
@@ -0,0 +1,29 @@
'use client';
import { useTheme } from '@/components/providers/theme-provider';
import { Toaster as Sonner } from 'sonner';
type ToasterProps = React.ComponentProps<typeof Sonner>;
export function Toaster({ ...props }: ToasterProps) {
const { resolvedTheme } = useTheme();
return (
<Sonner
theme={resolvedTheme as ToasterProps['theme']}
className="toaster group"
toastOptions={{
classNames: {
toast:
'group toast group-[.toaster]:bg-[var(--surface-elevated)] group-[.toaster]:text-[var(--foreground-primary)] group-[.toaster]:border-[var(--border-default)] group-[.toaster]:shadow-lg group-[.toaster]:rounded-2xl group-[.toaster]:font-sans',
description: 'group-[.toast]:text-[var(--foreground-secondary)]',
actionButton:
'group-[.toast]:bg-[var(--primary)] group-[.toast]:text-[var(--primary-foreground)]',
cancelButton:
'group-[.toast]:bg-[var(--muted)] group-[.toast]:text-[var(--muted-foreground)]',
},
}}
{...props}
/>
);
}