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;
|