UNPKG

@brizy/ui

Version:
13 lines (12 loc) 800 B
import React from "react"; import { TransitionGroup } from "react-transition-group"; import { Notice } from "./Notice"; import { BRZ_PREFIX } from "../constants"; const Notification = ({ notifications, position = "bottomCenter", offsetX, offsetY, onClose, }) => { const style = { "--offset-x": offsetX, "--offset-y": offsetY, }; return (React.createElement(TransitionGroup, { style: style, className: `${BRZ_PREFIX}-notifications ${BRZ_PREFIX}-notifications--${position}` }, notifications.map(({ id, text, type, duration, closable }) => (React.createElement(Notice, { key: id, id: id, text: text, type: type, duration: duration, closable: closable, onClose: onClose, timeout: 240, classNames: `${BRZ_PREFIX}-notifications--${position}` }))))); }; export { Notification };