"use client" import { type ComponentProps } from "react" import { variants } from "./variants" 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" export interface ButtonLinkProps extends Omit, "color">, VariantProps { leadingIconName?: MaterialIconName | null trailingIconName?: MaterialIconName | null } export default function ButtonLink({ variant, color, size, wrapping, fullWidth, className, href, target, leadingIconName, trailingIconName, children, ...props }: ButtonLinkProps) { const classNames = variants({ variant, color, size, wrapping, fullWidth, className, }) const intl = useIntl() const newTabText = intl.formatMessage({ id: "common.linkOpenInNewTab", defaultMessage: "Opens in a new tab/window", }) return ( {leadingIconName ? ( ) : null} {children} {trailingIconName ? ( ) : null} ) }