2024-05-27 08:46:48 -04:00
|
|
|
import { Label } from 'react-bootstrap'
|
2023-04-12 04:34:56 -04:00
|
|
|
import classnames from 'classnames'
|
|
|
|
import { MergeAndOverride } from '../../../../types/utils'
|
|
|
|
|
|
|
|
type BadgeProps = MergeAndOverride<
|
|
|
|
React.ComponentProps<'span'>,
|
|
|
|
{
|
|
|
|
prepend?: React.ReactNode
|
|
|
|
children: React.ReactNode
|
2024-04-19 08:30:23 -04:00
|
|
|
className?: string
|
2024-05-27 08:46:48 -04:00
|
|
|
bsStyle?: React.ComponentProps<typeof Label>['bsStyle'] | null
|
2023-04-12 04:34:56 -04:00
|
|
|
}
|
|
|
|
>
|
|
|
|
|
2024-05-27 08:46:48 -04:00
|
|
|
function Badge({ prepend, children, bsStyle, className, ...rest }: BadgeProps) {
|
2024-04-19 08:30:23 -04:00
|
|
|
const classNames =
|
|
|
|
bsStyle === null
|
|
|
|
? className
|
|
|
|
: classnames('label', `label-${bsStyle}`, className)
|
|
|
|
|
2023-04-12 04:34:56 -04:00
|
|
|
return (
|
2024-04-19 08:30:23 -04:00
|
|
|
<span className={classNames} {...rest}>
|
2024-05-27 08:46:48 -04:00
|
|
|
{prepend && <span className="badge-tag-bs3-prepend">{prepend}</span>}
|
2024-07-24 09:41:40 -04:00
|
|
|
<span className="badge-tag-bs3-content">{children}</span>
|
2023-04-12 04:34:56 -04:00
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Badge
|