From fe519e8685505f12580e00394bfe98b0fd312164 Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Tue, 30 Jan 2024 20:20:45 +0000 Subject: [PATCH] remove hover --- website/src/components/detailsToggle/index.js | 41 +------------------ website/src/components/faqs/index.js | 15 +------ 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/website/src/components/detailsToggle/index.js b/website/src/components/detailsToggle/index.js index 514ca52ba13..9f69d60aba6 100644 --- a/website/src/components/detailsToggle/index.js +++ b/website/src/components/detailsToggle/index.js @@ -3,47 +3,12 @@ import styles from './styles.module.css'; function detailsToggle({ children, alt_header = null }) { const [isOn, setOn] = useState(false); - const [isScrolling, setIsScrolling] = useState(false); // New state to track scrolling const [hoverTimeout, setHoverTimeout] = useState(null); const handleToggleClick = () => { - setOn(current => !current); // Toggle the current state + setOn(current => !current); }; - const handleMouseEnter = () => { - if (isOn || isScrolling) return; // Ignore hover if already open or if scrolling - const timeout = setTimeout(() => { - if (!isScrolling) setOn(true); - }, 700); // - setHoverTimeout(timeout); - }; - - const handleMouseLeave = () => { - if (!isOn) { - clearTimeout(hoverTimeout); - setOn(false); - } - }; - - const handleScroll = () => { - setIsScrolling(true); - clearTimeout(hoverTimeout); - //setOn(false); - - - // Reset scrolling state after a delay - setTimeout(() => { - setIsScrolling(false); - }, 800); - }; - - useEffect(() => { - window.addEventListener('scroll', handleScroll); - return () => { - window.removeEventListener('scroll', handleScroll); - }; - }, []); - useEffect(() => { return () => clearTimeout(hoverTimeout); }, [hoverTimeout]); @@ -53,13 +18,9 @@ function detailsToggle({ children, alt_header = null }) {   {alt_header} - {/* Visual disclaimer */} - Hover to view
{ - setHoverTimeout(setTimeout(() => { - setOn(true); - }, 500)); - }; - - const handleMouseLeave = () => { - if (!isOn) { - clearTimeout(hoverTimeout); - setOn(false); - } -}; useEffect(() => { return () => { @@ -66,11 +54,10 @@ function FAQ({ path, alt_header = null }) { }; return ( -
+
{alt_header || (fileContent?.meta && fileContent.meta.title)} - Hover to view
{fileContent?.contents}