Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Example() {
const menu = useMenuState();
return (
Menu
<menu aria-label="Menu">
<menuitem>a</menuitem>
<menuitem>b</menuitem>
<menuitem>
</menuitem></menu>
);
}
return ;
function ExamplesMenu({ location }) {
const menu = useMenuState({ unstable_boundariesElement: "viewport" });
const pathKeys = Object.keys(paths);
const currentPath = pathKeys.find(key => location.pathname.includes(key));
React.useEffect(() => {
if (menu.visible) {
menu.move(`examples-menu-${currentPath}`);
}
}, [menu.visible, menu.move, currentPath]);
return (
<div style="{{">
{currentPath}
<menu aria-label="Examples">
{pathKeys.map(path => (
</menu></div>
function Example() {
const menu = useMenuState({ unstable_animated: true });
return (
<>
Menu
<menu opacity="" transform="" aria-label="Menu">
<menuitem>Item 1</menuitem></menu>
function Example() {
const menu = useMenuState({ unstable_animated: true });
const { opacity, scale } = useSpring({
opacity: menu.visible ? 1 : 0,
scale: menu.visible ? 1 : 0,
onRest: menu.unstable_stopAnimation,
config: name => ({
tension: name === "opacity" ? 250 : 300,
friction: 25
})
});
return (
Menu
({ disclosure, tooltip, items, placement, ariaLabel, forceClose, ...props }, ref) => {
const menu = useMenuState({ placement, gutter: 20, unstable_animated: true })
const subRef = React.useRef(null)
const mainRef = React.useRef(null)
const [menuHeight, setMenuHeight] = React.useState(0)
const [submenuState, setSubmenuState] = React.useState(defaultSubmenuState)
const [animationState, setAnimationState] = React.useState(false)
const maxHeight = 240
const reset = () => {
setSubmenuState({ ...defaultSubmenuState })
}
const handleSubmenuOpen = id => {
setSubmenuState({ ...submenuState, id })
}