Skip to content

Commit 5107413

Browse files
committed
remove deprecated prop from new Link component
1 parent 5315c44 commit 5107413

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tailwind/Link.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ import { DISCORD_PATH, SITE_URL } from "@/lib/constants"
1414
import { useRtlFlip } from "@/hooks/useRtlFlip"
1515

1616
type BaseProps = {
17-
/** @deprecated Use `href` prop instead */
18-
to?: string
19-
href?: string
2017
hideArrow?: boolean
2118
isPartiallyActive?: boolean
2219
activeClassName?: string
2320
customEventOptions?: MatomoEventOptions
2421
}
2522

2623
export type LinkProps = BaseProps &
27-
Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> &
24+
AnchorHTMLAttributes<HTMLAnchorElement> &
2825
Omit<NextLinkProps, "href">
2926

3027
/**
@@ -41,8 +38,7 @@ export type LinkProps = BaseProps &
4138
*/
4239
export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
4340
{
44-
to,
45-
href: hrefProp,
41+
href,
4642
children,
4743
className,
4844
hideArrow,
@@ -56,7 +52,10 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
5652
const { asPath } = useRouter()
5753
const { flipForRtl } = useRtlFlip()
5854

59-
let href = (to ?? hrefProp) as string
55+
if (!href) {
56+
console.warn("Link component is missing href prop")
57+
return <a {...props} />
58+
}
6059

6160
const isActive = url.isHrefActive(href, asPath, isPartiallyActive)
6261
const isDiscordInvite = url.isDiscordInvite(href)

0 commit comments

Comments
 (0)