From 0de1ed0656234dcb1278b2a849d6dae9c6838101 Mon Sep 17 00:00:00 2001 From: Gurikov Maxim Date: Sat, 23 Nov 2024 17:41:49 +0500 Subject: [PATCH] fix --- src/components/reviews/review-form.tsx | 19 +++++++++++++++++-- src/consts/reviews.ts | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/consts/reviews.ts diff --git a/src/components/reviews/review-form.tsx b/src/components/reviews/review-form.tsx index c9d0916..143535a 100644 --- a/src/components/reviews/review-form.tsx +++ b/src/components/reviews/review-form.tsx @@ -1,6 +1,10 @@ import { useState } from 'react'; import { store, useAppSelector } from '../../store/store.ts'; import { postReview } from '../../store/actions.ts'; +import { + MAX_COMMENT_LENGTH, + MIN_COMMENT_LENGTH, +} from '../../consts/reviews.ts'; type UserReview = { comment?: string; @@ -29,7 +33,10 @@ export function ReviewForm(): React.JSX.Element { ); }; const isValid = - review?.comment && review?.comment?.length >= 50 && review?.rating; + review?.comment && + review?.comment?.length >= MIN_COMMENT_LENGTH && + review?.comment?.length <= MAX_COMMENT_LENGTH && + review?.rating; return (