mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
28 lines
783 B
TypeScript
28 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
|