import PropTypes from "prop-types"; const { Button } = wp.components; class ImageResizer extends React.Component { state = { imageWidth: this.props.width || "", imageHeight: this.props.height || "" }; onSizeChange = event => this.setState({ [event.target.name]: event.target.value }); onSubmit = () => { let { imageWidth, imageHeight } = this.state; if (!imageWidth && !imageHeight) return; if (!imageWidth) { imageWidth = imageHeight; } if (!imageHeight) { imageHeight = imageWidth; } this.props.onSizeChange(imageWidth, imageHeight); }; render() { const { imageWidth, imageHeight } = this.state; return (