phanpy/src/components/menu-link.jsx
2024-03-04 09:52:22 +08:00

22 lines
507 B
JavaScript

import { FocusableItem } from '@szhsin/react-menu';
import Link from './link';
function MenuLink(props) {
const { className, disabled, ...restProps } = props;
return (
<FocusableItem className={className} disabled={disabled}>
{({ ref, closeMenu }) => (
<Link
{...restProps}
ref={ref}
onClick={({ detail }) =>
closeMenu(detail === 0 ? 'Enter' : undefined)
}
/>
)}
</FocusableItem>
);
}
export default MenuLink;