0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Correctly used the max length variable for the bio text box in modal

refs https://github.com/TryGhost/Team/issues/1716
This commit is contained in:
James Morris 2022-08-04 13:28:52 +01:00 committed by Simon Backx
parent 0a1b1eb70a
commit 2027c88f58

View file

@ -11,8 +11,8 @@ const AddNameDialog = (props) => {
const [name, setName] = useState(member.name ?? ''); const [name, setName] = useState(member.name ?? '');
const [bio, setBio] = useState(member.bio ?? ''); const [bio, setBio] = useState(member.bio ?? '');
const maxBioCharsLeft = 50; const maxBioChars = 50;
const [bioCharsLeft, setBioCharsLeft] = useState(maxBioCharsLeft); const [bioCharsLeft, setBioCharsLeft] = useState(maxBioChars);
const [error, setError] = useState({name: '', bio: ''}); const [error, setError] = useState({name: '', bio: ''});
@ -116,7 +116,7 @@ const AddNameDialog = (props) => {
placeholder="Head of Marketing at Acme, Inc" placeholder="Head of Marketing at Acme, Inc"
onChange={(e) => { onChange={(e) => {
let bioText = e.target.value; let bioText = e.target.value;
setBioCharsLeft(maxBioCharsLeft - bioText.length); setBioCharsLeft(maxBioChars - bioText.length);
setBio(bioText); setBio(bioText);
}} }}
onKeyDown={(e) => { onKeyDown={(e) => {
@ -125,7 +125,7 @@ const AddNameDialog = (props) => {
submit(); submit();
} }
}} }}
maxLength="50" maxLength={maxBioChars}
/> />
<button <button
className="transition-opacity duration-200 ease-linear w-full h-[44px] mt-8 px-8 flex items-center justify-center rounded-md text-white font-sans font-semibold text-[15px] bg-[#3204F5] opacity-100 hover:opacity-90" className="transition-opacity duration-200 ease-linear w-full h-[44px] mt-8 px-8 flex items-center justify-center rounded-md text-white font-sans font-semibold text-[15px] bg-[#3204F5] opacity-100 hover:opacity-90"