useState } from "react";
export function PopupCategory({ open, toggle, toggleFalse }) {
const [translateState, setTranslateState] = useState(0);
console.log(open);
const handleMouseMove = () => {
document.body.style.position = "fixed";
setTranslateState((prev) => prev + 1);
const popup = document.querySelector(".PopupCategory");
popup.style.transition = "transform 0s ease-out 0s"
console.log(translateState);
if (translateState >= 100 && translateState <= 110) {
console.log(translateState);
document.body.style.position = "static";
popup.style.transform = "";
popup.style.transition = "5s ease-out 0s"
console.log(open);
toggleFalse();
setTranslateState(0);
console.log(open);
return;
}
popup.style.transform = translateY(-${translateState}vh);
};
console.log(open);
const popupClassNames = PopupCategory ${open ? "open" : ""};
console.log(popupClassNames);
return (
<div className={popupClassNames} onTouchMove={handleMouseMove}>
<nav className="Nav">
<ul>
<li className="NavItem">
<NavLink to="/">Home</NavLink>
</li>
<li className="NavItem">
<NavLink to="/about">About</NavLink>
</li>
<li className="NavItem">
<NavLink to="/contacts">Contacts</NavLink>
</li>
<li className="NavItem">
<NavLink to="/delivery">Delivery</NavLink>
</li>
</ul>
</nav>
</div>
);
}
Похоже на чатгпт
Обсуждают сегодня