import { InferType } from "prop-types"; import React from "react"; import { State } from "../state"; import Tool from "../tools/tool"; type propTypes = { tool: Tool; state: State; }; export class ToolButton extends React.PureComponent< propTypes, InferType<typeof ToolButton.stateTypes> > { static stateTypes = {}; render(): React.ReactNode { return ( <button title={this.props.tool.getName()} onClick={() => this.props.state.setTool(this.props.tool)} > <img src={this.props.tool.getIcon()} /> </button> ); } }