diff --git a/app/javascript/onboarding/components/ProfileForm.jsx b/app/javascript/onboarding/components/ProfileForm.jsx index 91c9ecf46..cbb2865cf 100644 --- a/app/javascript/onboarding/components/ProfileForm.jsx +++ b/app/javascript/onboarding/components/ProfileForm.jsx @@ -147,6 +147,8 @@ export class ProfileForm extends Component { this.props; const { profile_image_90, username, name } = this.user; const { canSkip, groups = [], error, errorMessage } = this.state; + const SUMMARY_MAXLENGTH = 200; + const summaryCharacters = this.state?.formValues?.summary?.length || 0; const sections = groups.map((group) => { return ( @@ -219,6 +221,7 @@ export class ProfileForm extends Component { label: 'Username', default_value: username, required: true, + maxLength: 20, }} onFieldChange={this.handleFieldChange} /> @@ -230,9 +233,21 @@ export class ProfileForm extends Component { label: 'Bio', placeholder_text: 'Tell us a little about yourself', required: false, + maxLength: SUMMARY_MAXLENGTH, }} onFieldChange={this.handleFieldChange} /> +
+ + Remaining characters: {SUMMARY_MAXLENGTH - summaryCharacters} + + + {summaryCharacters}/{SUMMARY_MAXLENGTH} + +
{sections} diff --git a/app/javascript/onboarding/components/ProfileForm/TextArea.jsx b/app/javascript/onboarding/components/ProfileForm/TextArea.jsx index 3ededd227..dfb719d77 100644 --- a/app/javascript/onboarding/components/ProfileForm/TextArea.jsx +++ b/app/javascript/onboarding/components/ProfileForm/TextArea.jsx @@ -27,7 +27,8 @@ import { FormField } from '@crayons'; export function TextArea(props) { const { onFieldChange } = props; - const { attribute_name, placeholder_text, description, label } = props.field; + const { attribute_name, placeholder_text, description, label, maxLength } = + props.field; return ({description}
}{description}
} @@ -61,5 +63,6 @@ TextInput.propTypes = { description: PropTypes.string.isRequired, label: PropTypes.string.isRequired, input_type: PropTypes.string.isRequired, + maxLength: PropTypes.number, }).isRequired, };