Skip to content

Commit 98b51a7

Browse files
committed
remove deprecated to prop from Link component
1 parent 62ae4b1 commit 98b51a7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/components/Link.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ import { DISCORD_PATH, SITE_URL } from "@/lib/constants"
1919
import { useRtlFlip } from "@/hooks/useRtlFlip"
2020

2121
type BaseProps = {
22-
/** @deprecated Use `href` prop instead */
23-
to?: string
24-
href?: string
2522
hideArrow?: boolean
2623
isPartiallyActive?: boolean
2724
activeStyle?: StyleProps
@@ -46,8 +43,7 @@ export type LinkProps = BaseProps &
4643
*/
4744
export const BaseLink = forwardRef(function Link(
4845
{
49-
to,
50-
href: hrefProp,
46+
href,
5147
children,
5248
hideArrow,
5349
isPartiallyActive = true,
@@ -60,7 +56,10 @@ export const BaseLink = forwardRef(function Link(
6056
const { asPath } = useRouter()
6157
const { flipForRtl } = useRtlFlip()
6258

63-
let href = (to ?? hrefProp) as string
59+
if (!href) {
60+
console.warn("Link component is missing href prop")
61+
return <ChakraLink {...props} />
62+
}
6463

6564
const isActive = url.isHrefActive(href, asPath, isPartiallyActive)
6665
const isDiscordInvite = url.isDiscordInvite(href)

src/components/PageHero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type PageHeroProps = {
4040

4141
const isButtonLink = (
4242
button: ButtonType | ButtonLinkType
43-
): button is ButtonLinkType => (button as ButtonLinkType).to !== undefined
43+
): button is ButtonLinkType => (button as ButtonLinkType).href !== undefined
4444

4545
const PageHero = ({
4646
content: { buttons, title, header, subtitle, image, alt },
@@ -105,7 +105,7 @@ const PageHero = ({
105105
<WrapItem key={idx}>
106106
<ButtonLink
107107
variant={button.variant}
108-
href={button.to}
108+
href={button.href}
109109
onClick={() =>
110110
trackCustomEvent({
111111
eventCategory: button.matomo.eventCategory,

0 commit comments

Comments
 (0)