main
| 1 | import { useMemo } from "react" |
| 2 | |
| 3 | type UseIsExternalLinkProps = { |
| 4 | href?: string |
| 5 | } |
| 6 | |
| 7 | export const useIsExternalLink = ({ href }: UseIsExternalLinkProps) => { |
| 8 | const isExternal = useMemo(() => { |
| 9 | return ( |
| 10 | href && |
| 11 | !href.startsWith("/") && |
| 12 | !href.startsWith("https://docs.medusajs.com") && |
| 13 | !href.startsWith("http://localhost:") && |
| 14 | !href.startsWith("#") |
| 15 | ) |
| 16 | }, [href]) |
| 17 | |
| 18 | return isExternal |
| 19 | } |