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