From 84377eed073f77c72351418ca5e387e03a402d9f Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sat, 9 Nov 2024 00:44:56 +0530 Subject: [PATCH] (fix:widget) broken for modals --- .../src/components/DocsGPTWidget.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/extensions/react-widget/src/components/DocsGPTWidget.tsx b/extensions/react-widget/src/components/DocsGPTWidget.tsx index d23d72f4..1d6537e6 100644 --- a/extensions/react-widget/src/components/DocsGPTWidget.tsx +++ b/extensions/react-widget/src/components/DocsGPTWidget.tsx @@ -132,7 +132,7 @@ const StyledContainer = styled.div` overflow: auto; } `; -const FloatingButton = styled.div<{ bgcolor: string,hidden:boolean }>` +const FloatingButton = styled.div<{ bgcolor: string, hidden: boolean }>` position: fixed; display: ${props => props.hidden ? "none" : "flex"}; z-index: 500; @@ -552,15 +552,17 @@ export const DocsGPTWidget = ({ }; const handleClose = () => { setOpen(false); - setTimeout(() => { - if(widgetRef.current) + size !== "large" ? setTimeout(() => { + if (widgetRef.current) widgetRef.current.style.display = "none" - }, 500); + }, 500) + : + widgetRef.current && (widgetRef.current.style.display = "none") }; const handleOpen = () => { - setOpen(true) - if(widgetRef.current) - widgetRef.current.style.display = 'block' + setOpen(true); + if (widgetRef.current) + widgetRef.current.style.display = 'block' } const dimensions = typeof size === 'object' && 'custom' in size @@ -570,15 +572,13 @@ export const DocsGPTWidget = ({ return ( {open && size === 'large' && - { - setOpen(false) - }} /> + } - + {