2024-06-06 11:37:47 -04:00
|
|
|
import { bs3ButtonProps, BS3ButtonSize } from './ol-button'
|
2024-04-16 11:06:42 -04:00
|
|
|
import { Button as BS3Button } from 'react-bootstrap'
|
|
|
|
import type { IconButtonProps } from '@/features/ui/components/types/icon-button-props'
|
2024-05-15 10:31:00 -04:00
|
|
|
import BootstrapVersionSwitcher from '../bootstrap-5/bootstrap-version-switcher'
|
2024-04-16 11:06:42 -04:00
|
|
|
import Icon, { IconProps } from '@/shared/components/icon'
|
2024-05-15 10:31:00 -04:00
|
|
|
import IconButton from '../bootstrap-5/icon-button'
|
2024-04-16 11:06:42 -04:00
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
export type OLIconButtonProps = IconButtonProps & {
|
2024-04-16 11:06:42 -04:00
|
|
|
bs3Props?: {
|
|
|
|
loading?: React.ReactNode
|
|
|
|
fw?: IconProps['fw']
|
2024-05-30 11:09:57 -04:00
|
|
|
className?: string
|
|
|
|
bsSize?: BS3ButtonSize
|
2024-04-16 11:06:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
export default function OLIconButton(props: OLIconButtonProps) {
|
2024-04-16 11:06:42 -04:00
|
|
|
const { bs3Props, ...rest } = props
|
|
|
|
|
2024-06-06 11:37:47 -04:00
|
|
|
const { fw, ...bs3Rest } = bs3Props || {}
|
2024-04-16 11:06:42 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<BootstrapVersionSwitcher
|
|
|
|
bs3={
|
2024-06-06 11:37:47 -04:00
|
|
|
<BS3Button {...bs3ButtonProps(rest)} {...bs3Rest}>
|
2024-04-16 11:06:42 -04:00
|
|
|
{bs3Props?.loading}
|
|
|
|
<Icon
|
|
|
|
type={rest.icon}
|
|
|
|
fw={fw}
|
|
|
|
accessibilityLabel={rest.accessibilityLabel}
|
|
|
|
/>
|
|
|
|
</BS3Button>
|
|
|
|
}
|
|
|
|
bs5={<IconButton {...rest} />}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|