@brizy/ui
Version:
React elements in Brizy style
19 lines (18 loc) • 1.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Notification = void 0;
const react_1 = __importDefault(require("react"));
const react_transition_group_1 = require("react-transition-group");
const Notice_1 = require("./Notice");
const constants_1 = require("../constants");
const Notification = ({ notifications, position = "bottomCenter", offsetX, offsetY, onClose, }) => {
const style = {
"--offset-x": offsetX,
"--offset-y": offsetY,
};
return (react_1.default.createElement(react_transition_group_1.TransitionGroup, { style: style, className: `${constants_1.BRZ_PREFIX}-notifications ${constants_1.BRZ_PREFIX}-notifications--${position}` }, notifications.map(({ id, text, type, duration, closable }) => (react_1.default.createElement(Notice_1.Notice, { key: id, id: id, text: text, type: type, duration: duration, closable: closable, onClose: onClose, timeout: 240, classNames: `${constants_1.BRZ_PREFIX}-notifications--${position}` })))));
};
exports.Notification = Notification;