diff --git a/apps/comments-ui/src/components/modals/AddDetailsDialog.js b/apps/comments-ui/src/components/modals/AddDetailsDialog.js index 80a515871a..190ea6b84e 100644 --- a/apps/comments-ui/src/components/modals/AddDetailsDialog.js +++ b/apps/comments-ui/src/components/modals/AddDetailsDialog.js @@ -11,6 +11,9 @@ const AddNameDialog = (props) => { const [name, setName] = useState(member.name ?? ''); const [bio, setBio] = useState(member.bio ?? ''); + const maxBioCharsLeft = 50; + const [bioCharsLeft, setBioCharsLeft] = useState(maxBioCharsLeft); + const [error, setError] = useState({name: '', bio: ''}); const close = (succeeded) => { @@ -101,28 +104,20 @@ const AddNameDialog = (props) => { }
- -
{error.bio}
-
+
{bioCharsLeft} characters left
{ - setBio(e.target.value); + let bioText = e.target.value; + setBioCharsLeft(maxBioCharsLeft - bioText.length); + setBio(bioText); }} onKeyDown={(e) => { if (e.key === 'Enter') {