UNPKG

@momentum-ui/react-collaboration

Version:

Cisco Momentum UI Framework for React Collaboration Applications

30 lines 1.84 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import React from 'react'; import classnames from 'classnames'; import { DEFAULTS, STYLE } from './TextToast.constants'; import './TextToast.style.scss'; import Text from '../Text/Text'; import Icon from '../Icon'; /** * The `<TextToast />` component. This component is designed to retrieve props like the `text` to display and the `textAlignment`, which can be `center` or `left` at the moment. * If no or an empty `text` is passed in, the component will not be rendered. If no `textAlignment` is passed in, the default alignment will be `center`. * Also the `iconProps` from the `Icon` component can be passed in to render a Icon on the left-hand side of the text. */ var TextToast = function (props) { var text = props.text, _a = props.textAlignment, textAlignment = _a === void 0 ? DEFAULTS.ALIGNMENT : _a, iconProps = props.iconProps, className = props.className, id = props.id, style = props.style; return (React.createElement(React.Fragment, null, (text === null || text === void 0 ? void 0 : text.length) > 0 && (React.createElement("div", { className: classnames(className, STYLE.wrapper), id: id, "data-text-alignment": textAlignment, style: style }, iconProps && iconProps.name && React.createElement(Icon, __assign({}, iconProps)), React.createElement(Text, { type: "body-secondary", tagName: "small", className: classnames(STYLE.text) }, text))))); }; export default TextToast; //# sourceMappingURL=TextToast.js.map