overleaf/services/web/frontend/js/features/ui/components/bootstrap-5/badge.tsx
Jessica Lawshe 5c63188200 Merge pull request #21832 from overleaf/jel-search-badges
[web] Add tooltips when needed on badge links in gallery search results

GitOrigin-RevId: edcdcf8134698f17f607e003627a8b4123519b0b
2024-11-18 09:06:22 +00:00

23 lines
616 B
TypeScript

import { Badge as BSBadge, BadgeProps as BSBadgeProps } from 'react-bootstrap-5'
import { MergeAndOverride } from '../../../../../../types/utils'
export type BadgeProps = MergeAndOverride<
BSBadgeProps,
{
prepend?: React.ReactNode
badgeContentRef?: React.RefObject<HTMLElement>
}
>
function Badge({ prepend, children, badgeContentRef, ...rest }: BadgeProps) {
return (
<BSBadge {...rest}>
{prepend && <span className="badge-prepend">{prepend}</span>}
<span className="badge-content" ref={badgeContentRef}>
{children}
</span>
</BSBadge>
)
}
export default Badge