overleaf/services/web/frontend/js/features/ui/components/bootstrap-5/icon-button.tsx
Rebeka Dekany fa3f51fb2e Merge pull request #17806 from overleaf/rd-bootstrap-button2
[web] - Updating the Account Settings page with the Button and Icon Button wrappers

GitOrigin-RevId: 135c4ddaa64d009d3ab8cdfef9cff899fd77669c
2024-04-17 08:05:10 +00:00

28 lines
842 B
TypeScript

import classNames from 'classnames'
import MaterialIcon from '@/shared/components/material-icon'
import Button from './button'
import type { IconButtonProps } from '@/features/ui/components/types/icon-button-props'
export default function IconButton({
accessibilityLabel,
icon,
isLoading = false,
size = 'default',
...props
}: IconButtonProps) {
const iconButtonClassName = `icon-button-${size}`
const iconSizeClassName = size === 'large' ? 'icon-large' : 'icon-small'
const materialIconClassName = classNames(iconSizeClassName, {
'button-content-hidden': isLoading,
})
return (
<Button className={iconButtonClassName} isLoading={isLoading} {...props}>
<MaterialIcon
accessibilityLabel={accessibilityLabel}
className={materialIconClassName}
type={icon}
/>
</Button>
)
}