import React, { Component } from "react"; import PropTypes from "prop-types"; import ReactTooltip from "react-tooltip"; import Button from "components/buttons/Button"; import Form from "components/forms/Form"; import formFieldInterface from "interfaces/form_field"; import InputField from "components/forms/fields/InputField"; import validate from "components/forms/UserSettingsForm/validate"; const formFields = ["email", "name", "position", "username"]; const baseClass = "manage-user"; class UserSettingsForm extends Component { static propTypes = { fields: PropTypes.shape({ email: formFieldInterface.isRequired, name: formFieldInterface.isRequired, position: formFieldInterface.isRequired, }).isRequired, handleSubmit: PropTypes.func.isRequired, pendingEmail: PropTypes.string, onCancel: PropTypes.func.isRequired, }; renderEmailHint = () => { const { pendingEmail } = this.props; if (!pendingEmail) { return undefined; } return ( Pending change to {pendingEmail} ); }; render() { const { fields, handleSubmit, onCancel } = this.props; const { renderEmailHint } = this; return (
); } } export default Form(UserSettingsForm, { fields: formFields, validate });