UNPKG

nice-ui

Version:

React design system, components, and utilities

33 lines (32 loc) 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToastCardStack = void 0; const React = require("react"); const Space_1 = require("../../3-list-item/Space"); const constants_1 = require("../../constants"); const ToastCardStack = ({ right, bottom, global, children }) => { const list = []; const length = children.length; for (let i = 0; i < length; i++) { const item = children[i]; if (!item) continue; list.push(React.createElement("div", { key: i }, item)); const isLast = i === length - 1; if (!isLast) list.push(React.createElement(Space_1.Space, { key: 'space-' + i })); } const style = { display: 'flex', flexDirection: bottom ? 'column-reverse' : 'column', alignItems: right ? 'flex-end' : 'flex-start', }; if (global) { style.position = 'fixed'; style.zIndex = constants_1.ZINDEX.TOAST; style[right ? 'right' : 'left'] = 16; style[bottom ? 'bottom' : 'top'] = 16; } return React.createElement("div", { style: style }, list); }; exports.ToastCardStack = ToastCardStack;