mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-17 21:05:04 -04:00
f78e619d87
[web ] Bootstrap 5 - rename the wrapper components and restructure GitOrigin-RevId: 7a76903df81cd546e9e469f24c4f203ea6a61672
41 lines
1 KiB
TypeScript
41 lines
1 KiB
TypeScript
import { Label } from 'react-bootstrap'
|
|
import Badge from '@/features/ui/components/bootstrap-5/badge'
|
|
import BS3Badge from '@/shared/components/badge'
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
type OLBadgeProps = React.ComponentProps<typeof Badge> & {
|
|
bs3Props?: {
|
|
bsStyle?: React.ComponentProps<typeof Label>['bsStyle'] | null
|
|
}
|
|
}
|
|
|
|
function OLBadge(props: OLBadgeProps) {
|
|
const { bs3Props, ...rest } = props
|
|
|
|
let bs3BadgeProps: React.ComponentProps<typeof BS3Badge> = {
|
|
prepend: rest.prepend,
|
|
children: rest.children,
|
|
closeBtnProps: rest.closeBtnProps,
|
|
className: rest.className,
|
|
bsStyle: rest.bg,
|
|
}
|
|
|
|
if (bs3Props) {
|
|
const { bsStyle, ...restBs3Props } = bs3Props
|
|
|
|
bs3BadgeProps = {
|
|
...bs3BadgeProps,
|
|
...restBs3Props,
|
|
bsStyle: 'bsStyle' in bs3Props ? bsStyle : rest.bg,
|
|
}
|
|
}
|
|
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<BS3Badge {...bs3BadgeProps} />}
|
|
bs5={<Badge {...rest} />}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default OLBadge
|