mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2025-12-06 03:55:37 -05:00
Initial changes
This commit is contained in:
47
src/components/notifications/ToastContainer.tsx
Normal file
47
src/components/notifications/ToastContainer.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import Toast, { ToastProps } from './Toast'
|
||||
|
||||
export type ToastPosition =
|
||||
| 'top-right'
|
||||
| 'top-left'
|
||||
| 'bottom-right'
|
||||
| 'bottom-left'
|
||||
| 'top-center'
|
||||
| 'bottom-center'
|
||||
|
||||
interface ToastContainerProps {
|
||||
toasts: Omit<ToastProps, 'onDismiss'>[];
|
||||
onDismiss: (id: string) => void;
|
||||
position?: ToastPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Container for toast notifications
|
||||
* Manages positioning and rendering of all toast notifications
|
||||
*/
|
||||
const ToastContainer = ({
|
||||
toasts,
|
||||
onDismiss,
|
||||
position = 'bottom-right',
|
||||
}: ToastContainerProps) => {
|
||||
if (toasts.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`toast-container ${position}`}>
|
||||
{toasts.map((toast) => (
|
||||
<Toast
|
||||
key={toast.id}
|
||||
id={toast.id}
|
||||
type={toast.type}
|
||||
title={toast.title}
|
||||
message={toast.message}
|
||||
duration={toast.duration}
|
||||
onDismiss={onDismiss}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ToastContainer
|
||||
Reference in New Issue
Block a user