mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-10 14:40:47 +02:00
21b5e44c50
Bootstrap-5 Dropdown menu component GitOrigin-RevId: 8a74f2341eebf953367ab73946d72e8aa7bd3c13
34 lines
767 B
TypeScript
34 lines
767 B
TypeScript
import { Button as BootstrapButton } from 'react-bootstrap-5'
|
|
import type { ButtonProps } from '@/features/ui/components/types/button-props'
|
|
|
|
const sizeClasses = new Map<ButtonProps['size'], string>([
|
|
['small', 'btn-sm'],
|
|
['default', ''],
|
|
['large', 'btn-lg'],
|
|
])
|
|
|
|
// TODO: Display a spinner when `loading` is true
|
|
function Button({
|
|
variant = 'primary',
|
|
size = 'default',
|
|
disabled = false,
|
|
loading = false,
|
|
children,
|
|
className,
|
|
}: ButtonProps) {
|
|
const sizeClass = sizeClasses.get(size)
|
|
|
|
return (
|
|
<BootstrapButton
|
|
className={sizeClass + ' ' + className}
|
|
variant={variant}
|
|
disabled={disabled}
|
|
{...(loading ? { 'data-ol-loading': true } : null)}
|
|
>
|
|
{children}
|
|
</BootstrapButton>
|
|
)
|
|
}
|
|
|
|
export default Button
|