(props?: LinkDOMProps)
| 187 | } |
| 188 | |
| 189 | export function useLinkProps(props?: LinkDOMProps): LinkDOMProps { |
| 190 | let router = useRouter(); |
| 191 | // oxlint-disable-next-line react/react-compiler |
| 192 | const href = router.useHref(props?.href ?? ''); |
| 193 | let linkProps: LinkDOMProps = {}; |
| 194 | if (props) { |
| 195 | for (let key of ['href', 'target', 'rel', 'download', 'ping', 'referrerPolicy']) { |
| 196 | if (key in props && props[key] !== undefined) { |
| 197 | linkProps[key] = key === 'href' ? href : props[key]; |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | return linkProps; |
| 202 | } |
| 203 | |
| 204 | export function handleLinkClick( |
| 205 | e: ReactMouseEvent, |
no test coverage detected