mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 06:41:37 -05:00
5c63188200
[web] Add tooltips when needed on badge links in gallery search results GitOrigin-RevId: edcdcf8134698f17f607e003627a8b4123519b0b
31 lines
699 B
TypeScript
31 lines
699 B
TypeScript
import classNames from 'classnames'
|
|
import type { MergeAndOverride } from '../../../../../../types/utils'
|
|
import Badge, { type BadgeProps } from './badge'
|
|
|
|
export type BadgeLinkProps = MergeAndOverride<
|
|
BadgeProps,
|
|
{
|
|
href: string
|
|
badgeContentRef?: React.RefObject<HTMLElement>
|
|
badgeLinkClasses?: string
|
|
}
|
|
>
|
|
|
|
function BadgeLink({
|
|
href,
|
|
badgeLinkClasses,
|
|
children,
|
|
...badgeProps
|
|
}: BadgeLinkProps) {
|
|
const containerClass = classNames(badgeLinkClasses, 'badge-link', {
|
|
[`badge-link-${badgeProps.bg}`]: badgeProps.bg,
|
|
})
|
|
|
|
return (
|
|
<a className={containerClass} href={href}>
|
|
<Badge {...badgeProps}>{children}</Badge>
|
|
</a>
|
|
)
|
|
}
|
|
|
|
export default BadgeLink
|