react-sleek
Version:
React Sleek Component Library
64 lines (63 loc) • 2.44 kB
JavaScript
;
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var typestyle_1 = require("typestyle");
var Colors_1 = require("../../Style/Colors");
var Radiuses_1 = require("../../Style/Radiuses");
var Spacings_1 = require("../../Style/Spacings");
var csx_1 = require("csx");
var Button = /** @class */ (function (_super) {
__extends(Button, _super);
function Button() {
return _super !== null && _super.apply(this, arguments) || this;
}
Button.prototype.render = function () {
var styleProps = {
backgroundColor: this.props.baseColor,
color: this.props.tintColor,
flex: this.props.full ? 1 : 0,
display: this.props.full ? 'flex' : 'inline-flex',
cursor: this.props.disabled ? 'not-allowed' : 'pointer',
};
if (this.props.disabled) {
styleProps.opacity = 0.6;
}
var buttonStyle = typestyle_1.style(styleProps);
return (React.createElement("div", { className: typestyle_1.classes(styles.buttonBase, buttonStyle), title: this.props.title, onClick: this.props.onClick }, this.props.children));
};
Button.defaultProps = {
alt: '',
title: '',
baseColor: Colors_1.default.Blue,
tintColor: Colors_1.default.White,
full: false,
disabled: false,
};
return Button;
}(React.PureComponent));
exports.default = Button;
var styles = {
buttonBase: typestyle_1.style({
height: csx_1.px(50),
fontSize: csx_1.px(18),
boxSizing: 'border-box',
padding: csx_1.px(Spacings_1.default.Tight) + " " + csx_1.px(Spacings_1.default.Compact),
justifyContent: 'center',
alignItems: 'center',
borderRadius: Radiuses_1.default.Medium,
userSelect: 'none',
}),
};