feat(BOOK-743): Replaced deprecated Button component

Approved-by: Bianca Widstam
This commit is contained in:
Erik Tiekstra
2026-01-21 09:38:38 +00:00
parent f834433d4d
commit 8e08af718c
77 changed files with 575 additions and 2233 deletions

View File

@@ -8,8 +8,8 @@ import type { VariantProps } from "class-variance-authority"
import Link from "next/link"
import { useIntl } from "react-intl"
import { MaterialIcon } from "../Icons/MaterialIcon"
import { Typography } from "../Typography"
import { MaterialIconName } from "../Icons/MaterialIcon/generated"
import { Typography } from "../Typography"
export interface ButtonLinkProps
extends
@@ -17,6 +17,7 @@ export interface ButtonLinkProps
VariantProps<typeof variants> {
leadingIconName?: MaterialIconName | null
trailingIconName?: MaterialIconName | null
isExternal?: boolean
}
export default function ButtonLink({
@@ -28,6 +29,7 @@ export default function ButtonLink({
className,
href,
target,
isExternal,
leadingIconName,
trailingIconName,
children,
@@ -48,6 +50,8 @@ export default function ButtonLink({
defaultMessage: "Opens in a new tab/window",
})
const LinkComponent = isExternal ? "a" : Link
return (
<Typography
variant={
@@ -56,9 +60,9 @@ export default function ButtonLink({
: "Body/Paragraph/mdBold"
}
>
<Link
<LinkComponent
className={classNames}
href={href}
href={href.toString()}
target={target}
title={target === "_blank" ? newTabText : ""}
{...props}
@@ -78,7 +82,7 @@ export default function ButtonLink({
size={size === "sm" ? 20 : 24}
/>
) : null}
</Link>
</LinkComponent>
</Typography>
)
}