From 94617c5ef72f126802f82de4a04402dd412440c9 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sat, 16 Nov 2024 02:13:40 +0530 Subject: [PATCH] (fix:animations) minor fix --- .../src/components/DocsGPTWidget.tsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/extensions/react-widget/src/components/DocsGPTWidget.tsx b/extensions/react-widget/src/components/DocsGPTWidget.tsx index 557aa9a0..725e829a 100644 --- a/extensions/react-widget/src/components/DocsGPTWidget.tsx +++ b/extensions/react-widget/src/components/DocsGPTWidget.tsx @@ -105,10 +105,10 @@ const WidgetContainer = styled.div<{ modal?: boolean, isOpen?: boolean }>` `; const StyledContainer = styled.div<{ isOpen: boolean }>` all: initial; - max-height: ${(props) => props.theme.dimensions.maxHeight} !important; - max-width: ${(props) => props.theme.dimensions.maxWidth} !important; - width: ${(props) => props.theme.dimensions.width} !important; - height: ${(props) => props.theme.dimensions.height} !important; + max-height: ${(props) => props.theme.dimensions.maxHeight}; + max-width: ${(props) => props.theme.dimensions.maxWidth}; + width: ${(props) => props.theme.dimensions.width}; + height: ${(props) => props.theme.dimensions.height} ; position: relative; flex-direction: column; justify-content: space-between; @@ -134,15 +134,15 @@ const StyledContainer = styled.div<{ isOpen: boolean }>` height: 100px; } 100% { - width: ${(props) => props.theme.dimensions.width}; - height: ${(props) => props.theme.dimensions.height}; + width: ${(props) => props.theme.dimensions.width} !important; + height: ${(props) => props.theme.dimensions.height} !important; border-radius: 12px; } } @keyframes closeContainer { 0% { - width: ${(props) => props.theme.dimensions.width}; - height: ${(props) => props.theme.dimensions.height}; + width: ${(props) => props.theme.dimensions.width} !important; + height: ${(props) => props.theme.dimensions.height} !important; border-radius: 12px; } 100% { @@ -495,13 +495,15 @@ export const DocsGPTWidget = (props: WidgetProps) => { const [isFloatingButtonVisible, setIsFloatingButtonVisible] = React.useState(true); React.useEffect(() => { - if(isFloatingButtonVisible) - setTimeout(() => setIsAnimatingButton(false), 400); + if (isFloatingButtonVisible) + setTimeout(() => setIsAnimatingButton(true), 250); + return () => { + setIsAnimatingButton(false) + } }, [isFloatingButtonVisible]) const handleClose = () => { setIsFloatingButtonVisible(true); - setIsAnimatingButton(true); setOpen(false); }; const handleOpen = () => { @@ -534,7 +536,6 @@ export const WidgetCore = ({ handleClose }: WidgetCoreProps) => { const [prompt, setPrompt] = React.useState(""); - console.log("propmpt", prompt); const [mounted, setMounted] = React.useState(false); const [status, setStatus] = React.useState('idle'); const [queries, setQueries] = React.useState([]); @@ -553,7 +554,6 @@ export const WidgetCore = ({ // Wait for animations before unmounting const timeout = setTimeout(() => { setMounted(false) - console.log("Unmounted syccess") }, 250); return () => clearTimeout(timeout); }