mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:35:26 -05:00
cccd0f06d7
[web] Create Bootstrap 5 badges GitOrigin-RevId: 72355c7cf7dca2a5d16bc890d7cfa4a432dd15ba
27 lines
783 B
TypeScript
27 lines
783 B
TypeScript
import { Badge as BSBadge } from 'react-bootstrap-5'
|
|
import { MergeAndOverride } from '../../../../../../types/utils'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
type BadgeProps = MergeAndOverride<
|
|
React.ComponentProps<typeof BSBadge>,
|
|
{
|
|
prepend?: React.ReactNode
|
|
closeBtnProps?: React.ComponentProps<'button'>
|
|
}
|
|
>
|
|
|
|
function Badge({ prepend, children, closeBtnProps, ...rest }: BadgeProps) {
|
|
return (
|
|
<BSBadge {...rest}>
|
|
{prepend && <span className="badge-prepend">{prepend}</span>}
|
|
{children}
|
|
{closeBtnProps && (
|
|
<button type="button" className="badge-close" {...closeBtnProps}>
|
|
<MaterialIcon className="badge-close-icon" type="close" />
|
|
</button>
|
|
)}
|
|
</BSBadge>
|
|
)
|
|
}
|
|
|
|
export default Badge
|