UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

22 lines 904 B
import { jsx as _jsx } from "preact/jsx-runtime"; import { useRef, useState } from "preact/hooks"; const MenuButton = ({ children, onClick }) => { const [hover, setHover] = useState(false); const olRef = useRef(null); const handleClick = () => { const ol = olRef.current; if (!ol) return; const { left, top } = ol.getBoundingClientRect(); onClick?.({ left, top }); }; return (_jsx("ol", { ref: olRef, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), onClick: handleClick, style: { whiteSpace: "nowrap", textAlign: "left", padding: "5px 10px 5px 10px", borderRadius: "4px", background: hover ? "rgba(255, 255, 255, 0.1)" : undefined }, children: children })); }; export default MenuButton; //# sourceMappingURL=MenuButton.js.map