UNPKG

react-life-design

Version:
59 lines 3.14 kB
"use strict"; 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); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var Button_styled_1 = require("./Button.styled"); var index_1 = require("../index"); var renderButtonAndHover = function (isType, children, response) { var mapElements = new Map(); mapElements .set('forward', (React.createElement(React.Fragment, null, children, React.createElement(index_1.Icons.SecondaryArrow, { color: index_1.Colors.white, width: 30, height: 20 })))) .set('disabled-forward', (React.createElement(React.Fragment, null, children, React.createElement(index_1.Icons.SecondaryArrow, { color: index_1.Colors.white, width: 30, height: 20 })))) .set('backward', (React.createElement(React.Fragment, null, React.createElement(index_1.Icons.SecondaryArrow, { color: index_1.Colors.white, degree: 180, width: 30, height: 20 }), children))) .set('readmore', (React.createElement(React.Fragment, null, children, React.createElement("svg", { className: 'svg down', xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 22 20.4' }, React.createElement("polyline", { className: 'switch-arrow-elements one', points: '0.8,19.7 10.4,10.2 0.8,0.7 ' }), React.createElement("polyline", { className: 'switch-arrow-elements two', points: '0.8,19.7 10.4,10.2 0.8,0.7 ' }))))) .set('confirm', children) .set('outline', children) .set('click', children) .set('link', children) .set('disabled', children); if (!response) { return mapElements.get(isType) || children; } return response === 'success' ? React.createElement(index_1.Icons.Success, null) : 'Tente de novo'; }; exports.default = (function (_a) { var children = _a.children, isType = _a.isType, loading = _a.loading, response = _a.response, disabled = _a.disabled, props = __rest(_a, ["children", "isType", "loading", "response", "disabled"]); return (React.createElement(Button_styled_1.default, __assign({ isType: isType, response: response, loading: loading }, props), !loading ? renderButtonAndHover(isType, children, response) : (React.createElement(React.Fragment, null, React.createElement(index_1.LDLoading, null), "\u00A0")))); }); //# sourceMappingURL=Button.js.map