Files
web/packages/design-system/lib/components/ButtonLink/index.tsx
Erik Tiekstra 6730575f7a feat(BOOK-113): Synced hover/focus states for buttons and added better examples to storybook
* fix(BOOK-113): Updated hover colors after blend/mix has been removed

Approved-by: Christel Westerberg
2025-12-03 10:45:34 +00:00

51 lines
952 B
TypeScript

'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'
export interface ButtonLinkProps
extends Omit<ComponentProps<typeof Link>, 'color'>,
VariantProps<typeof variants> {}
export default function ButtonLink({
variant,
color,
size,
typography,
wrapping,
className,
href,
target,
...props
}: ButtonLinkProps) {
const classNames = variants({
variant,
color,
size,
wrapping,
typography,
className,
})
const intl = useIntl()
const newTabText = intl.formatMessage({
id: 'common.linkOpenInNewTab',
defaultMessage: 'Opens in a new tab/window',
})
return (
<Link
className={classNames}
href={href}
target={target}
title={target === '_blank' ? newTabText : ''}
{...props}
/>
)
}