import { useEffect, useRef } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faGear, faXmark } from "@fortawesome/free-solid-svg-icons"; const Switcher = ({ setMode, mode, cursor1, cursor2 }) => { const switcherIcon = useRef(); const switcherItems = useRef(); const switcherOpen = useRef(); const switcherClose = useRef(); const cursorStyle = useRef(); useEffect(() => { if (typeof window !== "undefined") { switcherIcon.current.style.zIndex = "1000"; switcherItems.current.style.zIndex = "1000"; } }, [setMode]); const openSwitcher = () => { switcherOpen.current.style.display = "none"; switcherClose.current.style.display = "flex"; switcherIcon.current.style.right = "280px"; switcherItems.current.style.right = "0"; }; const closeSwitcher = () => { switcherClose.current.style.display = "none"; switcherOpen.current.style.display = "flex"; switcherIcon.current.style.right = "0"; switcherItems.current.style.right = "-280px"; }; const cursor = () => { let cursor_val = cursorStyle.current.value; if (cursor_val == "1") { cursor1.current.style.display = "none"; cursor2.current.style.display = "none"; } else { cursor1.current.style.display = ""; cursor2.current.style.display = ""; } }; const modeChange = (data) => { if (data == "dark") { if (setMode) { setMode("dark"); } } else { if (setMode) { setMode(""); } } }; return ( <>