mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 04:52:16 +00:00
bef43020cd
[web] BS5 projects tags GitOrigin-RevId: 4cdea8ad374c8b0ecba9281e3bde64517e6b0153
29 lines
801 B
TypeScript
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
|