mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fe7de51827
[web] Split badges and tags GitOrigin-RevId: fce5a93672f431ff74c2b63a67e249f5f7e7fecd
29 lines
754 B
TypeScript
29 lines
754 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>}
|
|
{children}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export default Badge
|