2024-04-19 08:30:23 -04:00
|
|
|
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'
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
type OLBadgeProps = React.ComponentProps<typeof Badge> & {
|
2024-04-19 08:30:23 -04:00
|
|
|
bs3Props?: {
|
|
|
|
bsStyle?: React.ComponentProps<typeof Label>['bsStyle'] | null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
function OLBadge(props: OLBadgeProps) {
|
2024-04-19 08:30:23 -04:00
|
|
|
const { bs3Props, ...rest } = props
|
|
|
|
|
|
|
|
let bs3BadgeProps: React.ComponentProps<typeof BS3Badge> = {
|
|
|
|
prepend: rest.prepend,
|
|
|
|
children: rest.children,
|
|
|
|
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} />}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
export default OLBadge
|