File size: 671 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import React from "react";
import PropTypes from "prop-types";
import "./Button.css";
export default class Button extends React.Component {
static propTypes = {
name: PropTypes.string,
orange: PropTypes.bool,
wide: PropTypes.bool,
clickHandler: PropTypes.func,
};
handleClick = () => {
this.props.clickHandler(this.props.name);
};
render() {
const className = [
"component-button",
this.props.orange ? "orange" : "",
this.props.wide ? "wide" : "",
];
return (
<div className={className.join(" ").trim()}>
<button onClick={this.handleClick}>{this.props.name}</button>
</div>
);
}
}
|