@blueprintjs/core
Version:
Core styles & components
50 lines (49 loc) • 1.76 kB
JavaScript
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import * as tslib_1 from "tslib";
import * as classNames from "classnames";
import * as PureRender from "pure-render-decorator";
import * as React from "react";
import * as Classes from "../../common/classes";
export var Elevation;
(function (Elevation) {
Elevation[Elevation["ZERO"] = 0] = "ZERO";
Elevation[Elevation["ONE"] = 1] = "ONE";
Elevation[Elevation["TWO"] = 2] = "TWO";
Elevation[Elevation["THREE"] = 3] = "THREE";
Elevation[Elevation["FOUR"] = 4] = "FOUR";
})(Elevation || (Elevation = {}));
var ELEVATION_CLASSES = [
Classes.ELEVATION_0,
Classes.ELEVATION_1,
Classes.ELEVATION_2,
Classes.ELEVATION_3,
Classes.ELEVATION_4,
];
var Card = (function (_super) {
tslib_1.__extends(Card, _super);
function Card() {
return _super !== null && _super.apply(this, arguments) || this;
}
Card.prototype.render = function () {
return (React.createElement("div", { className: this.getClassName(), onClick: this.props.onClick }, this.props.children));
};
Card.prototype.getClassName = function () {
var _a = this.props, elevation = _a.elevation, interactive = _a.interactive, className = _a.className;
return classNames(Classes.CARD, (_b = {}, _b[Classes.INTERACTIVE] = interactive, _b), ELEVATION_CLASSES[elevation], className);
var _b;
};
Card.displayName = "Blueprint.Card";
Card.defaultProps = {
elevation: Elevation.ZERO,
interactive: false,
};
Card = tslib_1.__decorate([
PureRender
], Card);
return Card;
}(React.Component));
export { Card };