This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch fix/1.3.5/bug
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/fix/1.3.5/bug by this push:
     new e6e57481 fix: form invalid styles
e6e57481 is described below

commit e6e574819503b830c80489f2dad9a0f3dfcab74b
Author: shuai <[email protected]>
AuthorDate: Fri Jun 7 15:50:46 2024 +0800

    fix: form invalid styles
---
 ui/src/pages/Questions/Ask/index.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ui/src/pages/Questions/Ask/index.tsx 
b/ui/src/pages/Questions/Ask/index.tsx
index bf06d1a3..40ff73e2 100644
--- a/ui/src/pages/Questions/Ask/index.tsx
+++ b/ui/src/pages/Questions/Ask/index.tsx
@@ -238,7 +238,7 @@ const Ask = () => {
   const handleTitleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
     setFormData({
       ...formData,
-      title: { ...formData.title, value: e.currentTarget.value, errorMsg: '' },
+      title: { value: e.currentTarget.value, errorMsg: '', isInvalid: false },
     });
     if (e.currentTarget.value.length >= 10) {
       querySimilarQuestions(e.currentTarget.value);
@@ -250,19 +250,19 @@ const Ask = () => {
   const handleContentChange = (value: string) => {
     setFormData({
       ...formData,
-      content: { ...formData.content, value, errorMsg: '' },
+      content: { value, errorMsg: '', isInvalid: false },
     });
   };
   const handleTagsChange = (value) =>
     setFormData({
       ...formData,
-      tags: { ...formData.tags, value, errorMsg: '' },
+      tags: { value, errorMsg: '', isInvalid: false },
     });
 
   const handleAnswerChange = (value: string) =>
     setFormData({
       ...formData,
-      answer_content: { ...formData.answer_content, value, errorMsg: '' },
+      answer_content: { value, errorMsg: '', isInvalid: false },
     });
 
   const handleSummaryChange = (evt: React.ChangeEvent<HTMLInputElement>) =>
@@ -541,6 +541,7 @@ const Ask = () => {
                       className={classNames(
                         'form-control p-0',
                         focusType === 'answer' && 'focus',
+                        formData.answer_content.isInvalid && 'is-invalid',
                       )}
                       onFocus={() => {
                         setForceType('answer');

Reply via email to