UNPKG

2.45 kBJavaScriptView Raw
1/*
2 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { __decorate, __extends } from "tslib";
17import classNames from "classnames";
18import * as React from "react";
19import { polyfill } from "react-lifecycles-compat";
20import { AbstractPureComponent2 } from "../../common";
21import * as Classes from "../../common/classes";
22import { DISPLAYNAME_PREFIX } from "../../common/props";
23import { ensureElement } from "../../common/utils";
24import { H4 } from "../html/html";
25import { Icon, IconSize } from "../icon/icon";
26var NonIdealState = /** @class */ (function (_super) {
27 __extends(NonIdealState, _super);
28 function NonIdealState() {
29 return _super !== null && _super.apply(this, arguments) || this;
30 }
31 NonIdealState.prototype.render = function () {
32 var _a = this.props, action = _a.action, children = _a.children, className = _a.className, description = _a.description, title = _a.title;
33 return (React.createElement("div", { className: classNames(Classes.NON_IDEAL_STATE, className) },
34 this.maybeRenderVisual(),
35 title && React.createElement(H4, null, title),
36 description && ensureElement(description, "div"),
37 action,
38 children));
39 };
40 NonIdealState.prototype.maybeRenderVisual = function () {
41 var icon = this.props.icon;
42 if (icon == null) {
43 return null;
44 }
45 else {
46 return (React.createElement("div", { className: Classes.NON_IDEAL_STATE_VISUAL },
47 React.createElement(Icon, { icon: icon, size: IconSize.LARGE * 3 })));
48 }
49 };
50 NonIdealState.displayName = DISPLAYNAME_PREFIX + ".NonIdealState";
51 NonIdealState = __decorate([
52 polyfill
53 ], NonIdealState);
54 return NonIdealState;
55}(AbstractPureComponent2));
56export { NonIdealState };
57//# sourceMappingURL=nonIdealState.js.map
\No newline at end of file