mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
* Merge intermediate component wrappers into OL-prefixed components * Replace all intermediate wrapper consumers with OL-prefixed components directly * Fix jsx/js files still importing deleted shim components * Remove duplicate OLNotification imports left by first pass * Rename OLTagIcon to TagIcon, remove OL prefix * Rename OLDropdownMenuItem to DropdownMenuItem, remove OL prefix * Remove OLNotification, use Notification directly * Move Notification to the main shared component folder * Update tag-icon import path out of ol/ * Move TagIcon to the main shared component folder * Update dropdown-menu-item import path out of ol/ * Move DropdownMenuItem to the main shared component folder * Fix dropdown-menu-item import path to dropdown/ subfolder * Remove BS5 alias prefixes from shared components * Restore notification-list wrapper in Notification component * Add translation for loading button * Remove redundant import aliasing * Resolve conflicts * Restore notification container `notification-list` GitOrigin-RevId: 24a5af18599a3e02ac6fd61c09cf5a49ef6e0020
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { forwardRef } from 'react'
|
|
import classNames from 'classnames'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import OLButton from './ol-button'
|
|
import type { IconButtonProps } from '@/shared/components/types/icon-button-props'
|
|
|
|
export type OLIconButtonProps = IconButtonProps
|
|
|
|
const OLIconButton = forwardRef<HTMLButtonElement, OLIconButtonProps>(
|
|
(
|
|
{
|
|
accessibilityLabel,
|
|
icon,
|
|
isLoading = false,
|
|
loadingLabel,
|
|
size,
|
|
className,
|
|
unfilled,
|
|
...props
|
|
},
|
|
ref
|
|
) => {
|
|
const iconButtonClassName = classNames(className, {
|
|
'icon-button': !size,
|
|
'icon-button-small': size === 'sm',
|
|
'icon-button-large': size === 'lg',
|
|
})
|
|
const iconSizeClassName = size === 'lg' ? 'icon-large' : 'icon-small'
|
|
const materialIconClassName = classNames(iconSizeClassName, {
|
|
'button-content-hidden': isLoading,
|
|
unfilled,
|
|
})
|
|
|
|
return (
|
|
<OLButton
|
|
className={iconButtonClassName}
|
|
isLoading={isLoading}
|
|
loadingLabel={loadingLabel}
|
|
aria-label={accessibilityLabel}
|
|
{...props}
|
|
ref={ref}
|
|
>
|
|
<MaterialIcon className={materialIconClassName} type={icon} />
|
|
</OLButton>
|
|
)
|
|
}
|
|
)
|
|
OLIconButton.displayName = 'OLIconButton'
|
|
|
|
export default OLIconButton
|