import React from 'react'; import PropTypes from 'prop-types'; import cn from 'classnames'; import styles from './ChangeUsernameDialog.css'; import InputField from './InputField'; import { Button, Dialog } from 'plugin-api/beta/client/components/ui'; class ChangeUsernameDialog extends React.Component { state = { showError: false, }; showError = () => { this.setState({ showError: true, }); }; confirmChanges = async () => { if (this.formHasError()) { this.showError(); } else { // await this.props.saveChanges this.props.closeDialog(); } }; formHasError = () => this.props.formData.confirmNewUsername !== this.props.formData.newUsername; render() { return ( ×

Confirm Username Change

You are attempting to change your username. Your new username will appear on all of your past and future comments.

Old Username: {this.props.username} New Username: {this.props.formData.newUsername}
Note: You will not be able to change your username again for 14 days
); } } ChangeUsernameDialog.propTypes = { closeDialog: PropTypes.func, showDialog: PropTypes.func, onChange: PropTypes.func, username: PropTypes.string, formData: PropTypes.object, }; export default ChangeUsernameDialog;