preact-material-design
Version:
A set of material components for Preact.
44 lines • 1.67 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { h, Component } from 'preact';
import { Ripple } from '../ripple/Ripple';
var Button = (function (_super) {
__extends(Button, _super);
function Button() {
return _super !== null && _super.apply(this, arguments) || this;
}
Button.prototype.render = function () {
var _a = this.props, children = _a.children, type = _a.type, dense = _a.dense, flat = _a.flat, disabled = _a.disabled, onClick = _a.onClick;
var btnClasses = ['pmd-button'];
if (dense) {
btnClasses.push('pmd-button--dense');
}
if (flat) {
btnClasses.push('pmd-button--flat');
}
if (disabled) {
btnClasses.push('pmd-button--disabled');
}
return (h("button", { class: btnClasses.join(' '), type: type, onClick: onClick },
h("div", { class: "pmd-button__inner" },
children,
h(Ripple, null))));
};
return Button;
}(Component));
export { Button };
Button.defaultProps = {
type: 'button',
dense: false,
flat: false,
disabled: false,
};
//# sourceMappingURL=Button.js.map