Skip to content

Commit 74fc3f7

Browse files
authored
Fix: Submit feedback confirmation does not auto close (#4240)
1 parent 3e384c6 commit 74fc3f7

1 file changed

Lines changed: 22 additions & 15 deletions

File tree

packages/gitbook/src/components/PageFeedback/PageFeedbackForm.tsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import React, { type ButtonHTMLAttributes } from 'react';
66
import { useLanguage } from '@/intl/client';
77
import { t, tString } from '@/intl/translate';
88
import { tcls } from '@/lib/tailwind';
9+
import { Icon } from '@gitbook/icons';
910
import { useTrackEvent } from '../Insights';
1011
import { Button, ButtonGroup, Input } from '../primitives';
1112

@@ -85,21 +86,27 @@ export function PageFeedbackForm(props: {
8586
</ButtonGroup>
8687
</div>
8788
{rating ? (
88-
<Input
89-
ref={inputRef}
90-
label={tString(languages, 'was_this_helpful_comment')}
91-
multiline
92-
submitButton
93-
rows={3}
94-
name="page-feedback-comment"
95-
onSubmit={(comment) => onSubmitComment(rating, comment as string)}
96-
maxLength={MAX_COMMENT_LENGTH}
97-
minLength={MIN_COMMENT_LENGTH}
98-
disabled={submitted}
99-
submitMessage={tString(languages, 'was_this_helpful_thank_you')}
100-
className="animate-blur-in"
101-
resize
102-
/>
89+
submitted ? (
90+
<div className="flex animate-blur-in-display-slow items-center gap-1 p-1.5 text-success-subtle">
91+
<Icon icon="check-circle" className="size-4" />
92+
{tString(languages, 'was_this_helpful_thank_you')}
93+
</div>
94+
) : (
95+
<Input
96+
ref={inputRef}
97+
label={tString(languages, 'was_this_helpful_comment')}
98+
multiline
99+
submitButton
100+
rows={3}
101+
name="page-feedback-comment"
102+
onSubmit={(comment) => onSubmitComment(rating, comment as string)}
103+
maxLength={MAX_COMMENT_LENGTH}
104+
minLength={MIN_COMMENT_LENGTH}
105+
disabled={submitted}
106+
className="animate-blur-in"
107+
resize
108+
/>
109+
)
103110
) : null}
104111
</div>
105112
);

0 commit comments

Comments
 (0)