mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
481cd14cb1
[web] History labels only list GitOrigin-RevId: 58b8e5a5af0754e32841223f9c478c25900df526
43 lines
982 B
TypeScript
43 lines
982 B
TypeScript
import classnames from 'classnames'
|
|
import { MergeAndOverride } from '../../../../types/utils'
|
|
|
|
type BadgeProps = MergeAndOverride<
|
|
React.ComponentProps<'span'>,
|
|
{
|
|
prepend?: React.ReactNode
|
|
children: React.ReactNode
|
|
className?: string
|
|
showCloseButton?: boolean
|
|
onClose?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
|
closeBtnProps?: React.ComponentProps<'button'>
|
|
}
|
|
>
|
|
|
|
function Badge({
|
|
prepend,
|
|
children,
|
|
className,
|
|
showCloseButton = false,
|
|
onClose,
|
|
closeBtnProps,
|
|
...rest
|
|
}: BadgeProps) {
|
|
return (
|
|
<span className={classnames('badge-new', className)} {...rest}>
|
|
{prepend}
|
|
<span className="badge-new-comment">{children}</span>
|
|
{showCloseButton && (
|
|
<button
|
|
type="button"
|
|
className="badge-new-close"
|
|
onClick={onClose}
|
|
{...closeBtnProps}
|
|
>
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
)}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export default Badge
|