Fix wrong max count showing on suggestion comment

This commit is contained in:
Kalle 2022-06-25 21:50:47 +03:00
parent bca8fd6da8
commit 80a53085c5
2 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,7 @@ export default function PlusCommentModalPage() {
{userBeingCommented.suggestedUser.discordName}'s +
{tierSuggestedTo} suggestion
</h2>
<CommentTextarea />
<CommentTextarea maxLength={PlUS_SUGGESTION_COMMENT_MAX_LENGTH} />
<div className="plus__modal-buttons">
<Button type="submit" data-cy="submit-button">
Submit

View File

@ -150,7 +150,7 @@ export default function PlusNewSuggestionModalPage() {
<ErrorMessage>{selectedUserErrorMessage}</ErrorMessage>
) : null}
</div>
<CommentTextarea />
<CommentTextarea maxLength={PlUS_SUGGESTION_FIRST_COMMENT_MAX_LENGTH} />
<div className="plus__modal-buttons">
<Button
type="submit"
@ -199,7 +199,7 @@ function getSelectedUserErrorMessage({
}
// TODO: better UX - allow going over but prevent submit like Twitter
export function CommentTextarea() {
export function CommentTextarea({ maxLength }: { maxLength: number }) {
const [value, setValue] = React.useState("");
return (
<div>
@ -207,7 +207,7 @@ export function CommentTextarea() {
htmlFor="text"
valueLimits={{
current: value.length,
max: PlUS_SUGGESTION_FIRST_COMMENT_MAX_LENGTH,
max: maxLength,
}}
>
Your comment
@ -219,7 +219,7 @@ export function CommentTextarea() {
rows={4}
value={value}
onChange={(e) => setValue(e.target.value)}
maxLength={PlUS_SUGGESTION_FIRST_COMMENT_MAX_LENGTH}
maxLength={maxLength}
data-cy="comment-textarea"
required
/>