Files
Palmr/apps/docs/src/components/ui/toast.tsx
Daniel Luiz Alves 8f30883404 feat: update to v3.0-beta with new features and improvements
- Updated versioning across multiple components and documentation to v3.0-beta.
- Introduced new Docker Compose configurations for S3-compatible storage and MinIO support.
- Enhanced the documentation with new guides for API usage, architecture, and user management.
- Improved localization and user experience in the frontend with updated UI components and styles.
- Removed outdated Docker configurations and files to streamline the setup process.
- Added new utilities for key generation and improved error handling in various components.
- Updated license to reflect the new Kyantech-Permissive License.
2025-06-13 02:23:15 -03:00

32 lines
917 B
TypeScript

"use client";
import { useEffect } from "react";
import { createPortal } from "react-dom";
import { CheckCircle } from "lucide-react";
interface ToastProps {
message: string;
duration?: number;
onClose: () => void;
}
export function Toast({ message, duration = 2000, onClose }: ToastProps) {
useEffect(() => {
const timer = setTimeout(() => {
onClose();
}, duration);
return () => clearTimeout(timer);
}, [duration, onClose]);
return createPortal(
<div className="fixed bottom-4 right-4 z-50 animate-in fade-in slide-in-from-bottom-4">
<div className="flex items-center gap-2 bg-white dark:bg-black/80 text-black dark:text-white px-4 py-2 rounded-md shadow-lg border border-gray-200 dark:border-gray-700">
<CheckCircle className="h-5 w-5 text-green-400" />
<p className="text-sm font-medium">{message}</p>
</div>
</div>,
document.body
);
}