UNPKG

@momentum-ui/react-collaboration

Version:

Cisco Momentum UI Framework for React Collaboration Applications

28 lines 1.51 kB
import React, { cloneElement } from 'react'; import classnames from 'classnames'; import { STYLE } from './ToastContent.constants'; import './ToastContent.style.scss'; /** * The `<ToastContent />` component. This component is meant to be consumed by only the `<Toast />` component. */ var ToastContent = function (props) { var action = props.action, actionColor = props.actionColor, actions = props.actions, actor = props.actor, children = props.children, className = props.className, id = props.id, info = props.info, style = props.style; var actorComponent = actor ? React.createElement("span", { className: STYLE.actor }, actor) : null; var actionComponent = action ? (React.createElement("span", { className: STYLE.action, "data-color": actionColor }, action)) : null; var scopeComponent = action || actor ? (React.createElement("div", { className: STYLE.scope }, actorComponent, " ", actionComponent)) : null; var infoComponent = info || children ? React.createElement("div", { className: STYLE.info }, info || children) : null; var actionsComponent = actions ? cloneElement(actions, { className: classnames(STYLE.actions, actions.props.className), }) : null; return (React.createElement("div", { className: classnames(className, STYLE.wrapper), id: id, style: style }, scopeComponent, infoComponent, actionsComponent)); }; export default ToastContent; //# sourceMappingURL=ToastContent.js.map