32 lines
788 B
TypeScript
32 lines
788 B
TypeScript
import type { Notification } from '../types/types';
|
||
|
||
type Props = {
|
||
notifications: Notification[];
|
||
onRemove: (id: number) => void;
|
||
};
|
||
|
||
export default function Notifications({ notifications, onRemove }: Props) {
|
||
return (
|
||
<div className="notifications">
|
||
{notifications.map((n) => (
|
||
<div
|
||
key={n.id}
|
||
className={`notification ${n.type} ${n.removing ? 'notification-out' : ''}`}
|
||
>
|
||
<span className="notification-message" title={n.message}>
|
||
{n.message}
|
||
</span>
|
||
|
||
<button
|
||
className="tab-close notification-close"
|
||
onClick={() => onRemove(n.id)}
|
||
aria-label="Dismiss notification"
|
||
>
|
||
×
|
||
</button>
|
||
</div>
|
||
))}
|
||
</div>
|
||
);
|
||
}
|