From b4b36c45de25305f43ee83441f13a75c48b07994 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 9 Aug 2024 16:58:48 +0700 Subject: update higlight button whatsapp --- src/core/components/layouts/BasicLayout.jsx | 88 +++++++++++++++++------------ 1 file changed, 51 insertions(+), 37 deletions(-) (limited to 'src/core/components/layouts/BasicLayout.jsx') diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx index 62c74e3c..99968ca0 100644 --- a/src/core/components/layouts/BasicLayout.jsx +++ b/src/core/components/layouts/BasicLayout.jsx @@ -7,7 +7,7 @@ import { useProductContext } from '@/contexts/ProductContext'; import odooApi from '@/core/api/odooApi'; import whatsappUrl from '@/core/utils/whatsappUrl'; import Navbar from '../elements/Navbar/Navbar'; -import styles from './BasicLayout.module.css'; // Import modul CSS +import styles from './BasicLayout.module.css'; // Import modul CSS jika perlu const AnimationLayout = dynamic(() => import('./AnimationLayout'), { ssr: false, @@ -22,6 +22,7 @@ const BasicLayout = ({ children }) => { const [urlPath, setUrlPath] = useState(null); const [highlight, setHighlight] = useState(false); const [buttonPosition, setButtonPosition] = useState(null); + const [wobble, setWobble] = useState(false); const router = useRouter(); const buttonRef = useRef(null); @@ -47,9 +48,8 @@ const BasicLayout = ({ children }) => { useEffect(() => { const handleMouseOut = (event) => { const rect = buttonRef.current.getBoundingClientRect(); - console.log("rect",rect) if (event.clientY <= 0) { - console.log("ini pindah") + setButtonPosition(rect) setHighlight(true); } else { setHighlight(false); @@ -63,6 +63,14 @@ const BasicLayout = ({ children }) => { }; }, []); + useEffect(() => { + if (highlight) { + // Set wobble animation after overlay highlight animation completes + const timer = setTimeout(() => setWobble(true), 1000); // Adjust timing if needed + return () => clearTimeout(timer); + } + }, [highlight]); + const recordActivity = async (pathname) => { const ONLY_ON_PATH = false; const recordedPath = []; @@ -84,44 +92,50 @@ const BasicLayout = ({ children }) => { return ( <> + {highlight && buttonPosition && ( +
setHighlight(false)} + /> + )} {children} - {highlight && buttonPosition && ( -
setHighlight(false)} - /> - )} -- cgit v1.2.3