wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
41 lines • 1.67 kB
JavaScript
import { __extends } from "tslib";
import React, { PureComponent } from 'react';
import classNames from 'classnames';
import styles from './button.scss';
import PropTypes from 'prop-types';
var Button = /** @class */ (function (_super) {
__extends(Button, _super);
function Button() {
return _super !== null && _super.apply(this, arguments) || this;
}
Button.prototype.render = function () {
var _a;
var _b = this.props, size = _b.size, className = _b.className, fullWidth = _b.fullWidth, children = _b.children, dataHook = _b.dataHook, disabled = _b.disabled, onClick = _b.onClick;
return (React.createElement("button", { className: classNames(className, styles.root, styles["size-".concat(size)], (_a = {},
_a[styles.fluid] = fullWidth,
_a)), disabled: disabled, "data-hook": dataHook, onClick: onClick }, children));
};
Button.displayName = 'Button';
Button.propTypes = {
/** Additional classes */
className: PropTypes.string,
/** Size of Button content */
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large']),
/** Click event handler */
onClick: PropTypes.func,
/** Sets button width to 100% */
fullWidth: PropTypes.bool,
/** Applies disabled styles */
disabled: PropTypes.bool,
/** String based node */
children: PropTypes.node,
/** String based data hook */
dataHook: PropTypes.string,
};
Button.defaultProps = {
size: 'medium',
};
return Button;
}(PureComponent));
export default Button;
//# sourceMappingURL=button.js.map