import React from 'react'; import PropTypes from 'prop-types'; import { Alert, Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Input, InputGroup, InputGroupAddon, InputGroupText } from 'reactstrap'; import { gettext } from '../../../utils/constants'; import { Utils } from '../../../utils/utils'; const propTypes = { dialogTitle: PropTypes.string.isRequired, updateValue: PropTypes.func.isRequired, toggleDialog: PropTypes.func.isRequired }; class UpdateUser extends React.Component { constructor(props) { super(props); this.state = { value: this.props.value, isSubmitBtnActive: false }; } handleInputChange = (e) => { const value = e.target.value; this.setState({ value: value }); } handleKeyPress = (e) => { if (e.key == 'Enter') { this.handleSubmit(); e.preventDefault(); } } handleSubmit = () => { this.props.updateValue(this.state.value.trim()); this.props.toggleDialog(); } render() { const { dialogTitle, toggleDialog } = this.props; return ( {this.props.dialogTitle}
); } } UpdateUser.propTypes = propTypes; export default UpdateUser;