UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

87 lines 3.56 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); 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); }; Object.defineProperty(exports, "__esModule", { value: true }); // (C) 2007-2018 GoodData Corporation var React = require("react"); var PropTypes = require("prop-types"); exports.ErrorPropTypes = { icon: PropTypes.string, message: PropTypes.string.isRequired, className: PropTypes.string, style: PropTypes.object, width: PropTypes.any, height: PropTypes.any, }; /** * [ErrorComponent](http://sdk.gooddata.com/gooddata-ui/docs/error_component.html) * is a component that renders a default error message */ var ErrorComponent = /** @class */ (function (_super) { __extends(ErrorComponent, _super); function ErrorComponent() { return _super !== null && _super.apply(this, arguments) || this; } ErrorComponent.prototype.render = function () { var _a = this.props, className = _a.className, style = _a.style, width = _a.width, height = _a.height, message = _a.message, description = _a.description, icon = _a.icon; var wrapperStyle = __assign({}, style, { width: width, height: height }); return (React.createElement("div", { className: className, style: wrapperStyle }, React.createElement("div", { className: "info-label", style: { fontSize: "14px", fontWeight: 400, lineHeight: "normal", color: "#94a1ad", textAlign: "center", } }, icon ? React.createElement("div", { className: "info-label-icon " + icon, style: { fontSize: "40px" } }) : null, React.createElement("div", { style: { fontWeight: 400, fontSize: "20px", textTransform: "uppercase", } }, message), React.createElement("div", { style: { margin: "3px 0" } }, description)))); }; ErrorComponent.defaultProps = { icon: "icon-warning", className: "Error s-error", width: undefined, height: "100%", style: { display: "flex", flex: "1 0 auto", flexDirection: "column", alignItems: "center", justifyContent: "center", whiteSpace: "normal", lineHeight: "normal", fontFamily: "avenir, Helvetica Neue, arial, sans-serif", }, }; ErrorComponent.propTypes = exports.ErrorPropTypes; return ErrorComponent; }(React.Component)); exports.ErrorComponent = ErrorComponent; //# sourceMappingURL=ErrorComponent.js.map