From bd1fe6aaf83f0ccc8d4f399fae334010ece75771 Mon Sep 17 00:00:00 2001 From: Anaz N Date: Thu, 2 Nov 2023 21:05:48 +0530 Subject: [PATCH] In Documentation,Pop-ups which shows Is this page useful?, will never disapper - issue fix --- src/components/Layout/Feedback.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index 86fc91350a9..c0cd1cf5288 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -2,7 +2,7 @@ * Copyright (c) Facebook, Inc. and its affiliates. */ -import {useState} from 'react'; +import {useEffect, useState} from 'react'; import {useRouter} from 'next/router'; export function Feedback({onSubmit = () => {}}: {onSubmit?: () => void}) { @@ -57,8 +57,19 @@ function sendGAEvent(isPositive: boolean) { function SendFeedback({onSubmit}: {onSubmit: () => void}) { const [isSubmitted, setIsSubmitted] = useState(false); + const [showFeedback, setShowFeedback] = useState(true); + useEffect(() => { + const timer = setTimeout(() => { + isSubmitted && setShowFeedback(false); + }, 1000); + return () => clearTimeout(timer); + }, [isSubmitted]); + return ( -
+

{isSubmitted ? 'Thank you for your feedback!' : 'Is this page useful?'}