overleaf/services/web/frontend/js/features/ui/components/bootstrap-5/badge-link.tsx
M Fahru 862fb9f2ae Merge pull request #21268 from overleaf/mf-new-gallery-search-result-badge
[web] Standardize `.badge` styling and HTML structure for both gallery-search and blog post page

GitOrigin-RevId: edfaceb61900897178654a920995e5c857fe7107
2024-10-28 09:05:55 +00:00

24 lines
567 B
TypeScript

import classNames from 'classnames'
import type { MergeAndOverride } from '../../../../../../types/utils'
import Badge, { type BadgeProps } from './badge'
type BadgeLinkProps = MergeAndOverride<
BadgeProps,
{
href: string
}
>
function BadgeLink({ href, children, ...badgeProps }: BadgeLinkProps) {
const containerClass = classNames('badge-link', {
[`badge-link-${badgeProps.bg}`]: badgeProps.bg,
})
return (
<a className={containerClass} href={href}>
<Badge {...badgeProps}>{children}</Badge>
</a>
)
}
export default BadgeLink