(href: ProjectLinkHref<T>)
| 20 | } & Omit<LinkProps, "href">; |
| 21 | |
| 22 | export function useProjectLink<T extends ProjectRoute>(href: ProjectLinkHref<T>) { |
| 23 | const selectedProject = useSelectedProject().data; |
| 24 | |
| 25 | return useMemo(() => { |
| 26 | const pathname = typeof href === "string" ? href : href.pathname; |
| 27 | const query = typeof href === "string" ? {} : href.query; |
| 28 | |
| 29 | return { |
| 30 | pathname: `/p/[projectSlug]${pathname}`, |
| 31 | query: { projectSlug: selectedProject?.slug, ...query }, |
| 32 | }; |
| 33 | }, [selectedProject?.slug, href]); |
| 34 | } |
| 35 | |
| 36 | export const ProjectLink = forwardRef( |
| 37 | <T extends ProjectRoute>( |
no test coverage detected