phanpy/src/components/menu-link.jsx

23 lines
507 B
React
Raw Normal View History

2023-02-16 12:51:54 +03:00
import { FocusableItem } from '@szhsin/react-menu';
import Link from './link';
function MenuLink(props) {
2024-03-04 04:52:22 +03:00
const { className, disabled, ...restProps } = props;
2023-02-16 12:51:54 +03:00
return (
2024-03-04 04:52:22 +03:00
<FocusableItem className={className} disabled={disabled}>
2023-02-16 12:51:54 +03:00
{({ ref, closeMenu }) => (
<Link
2024-03-04 04:52:22 +03:00
{...restProps}
2023-02-16 12:51:54 +03:00
ref={ref}
onClick={({ detail }) =>
closeMenu(detail === 0 ? 'Enter' : undefined)
}
/>
)}
</FocusableItem>
);
}
export default MenuLink;