overleaf/services/web/frontend/js/shared/components/badge.tsx
ilkin-overleaf bef43020cd Merge pull request #19466 from overleaf/ii-bs5-projects-tags
[web] BS5 projects tags

GitOrigin-RevId: 4cdea8ad374c8b0ecba9281e3bde64517e6b0153
2024-07-25 08:05:20 +00:00

29 lines
801 B
TypeScript

import { Label } from 'react-bootstrap'
import classnames from 'classnames'
import { MergeAndOverride } from '../../../../types/utils'
type BadgeProps = MergeAndOverride<
React.ComponentProps<'span'>,
{
prepend?: React.ReactNode
children: React.ReactNode
className?: string
bsStyle?: React.ComponentProps<typeof Label>['bsStyle'] | null
}
>
function Badge({ prepend, children, bsStyle, className, ...rest }: BadgeProps) {
const classNames =
bsStyle === null
? className
: classnames('label', `label-${bsStyle}`, className)
return (
<span className={classNames} {...rest}>
{prepend && <span className="badge-tag-bs3-prepend">{prepend}</span>}
<span className="badge-tag-bs3-content">{children}</span>
</span>
)
}
export default Badge