UNPKG

robust-react-ui

Version:

A React component library, built with a focus on accessibility, extensibility and reusability.

32 lines (27 loc) 1.68 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var React = require('react'); var React__default = _interopDefault(React); var index = require('../../utils/getClassNames/index.js'); // Generated with util/create-component.js var Alert = function (_a) { var _b; var children = _a.children, _c = _a.variant, variant = _c === void 0 ? 'primary' : _c, fullWidth = _a.fullWidth, visible = _a.visible, onCloseActionFunction = _a.onCloseActionFunction; return (React__default.createElement("div", { "data-testid": "Alert", role: "alert", className: index((_b = { 'rrui-alert': true }, _b["rrui-alert--" + variant] = true, _b['rrui-alert--full-width'] = fullWidth, _b['rrui-alert--hidden'] = visible === false, _b)) }, React__default.createElement("button", { type: "button", className: "rrui-alert__button", "aria-label": "close alert", onClick: function () { if (onCloseActionFunction) onCloseActionFunction(!visible); } }, React__default.createElement("svg", { className: "rrui-alert__icon", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, React__default.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), React__default.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))), children)); }; module.exports = Alert; //# sourceMappingURL=Alert.js.map