2024-10-25 10:37:10 -04:00
|
|
|
import classNames from 'classnames'
|
|
|
|
import type { MergeAndOverride } from '../../../../../../types/utils'
|
|
|
|
import Badge, { type BadgeProps } from './badge'
|
|
|
|
|
2024-11-15 11:31:24 -05:00
|
|
|
export type BadgeLinkProps = MergeAndOverride<
|
2024-10-25 10:37:10 -04:00
|
|
|
BadgeProps,
|
|
|
|
{
|
|
|
|
href: string
|
2024-11-15 11:31:24 -05:00
|
|
|
badgeContentRef?: React.RefObject<HTMLElement>
|
|
|
|
badgeLinkClasses?: string
|
2024-10-25 10:37:10 -04:00
|
|
|
}
|
|
|
|
>
|
|
|
|
|
2024-11-15 11:31:24 -05:00
|
|
|
function BadgeLink({
|
|
|
|
href,
|
|
|
|
badgeLinkClasses,
|
|
|
|
children,
|
|
|
|
...badgeProps
|
|
|
|
}: BadgeLinkProps) {
|
|
|
|
const containerClass = classNames(badgeLinkClasses, 'badge-link', {
|
2024-10-25 10:37:10 -04:00
|
|
|
[`badge-link-${badgeProps.bg}`]: badgeProps.bg,
|
|
|
|
})
|
|
|
|
|
|
|
|
return (
|
|
|
|
<a className={containerClass} href={href}>
|
|
|
|
<Badge {...badgeProps}>{children}</Badge>
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BadgeLink
|