mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
b1c40d05f7
[web] Fix the Button component accessibility label GitOrigin-RevId: 1d157fca370c5e0425890468d7cad169d0261c23
26 lines
704 B
TypeScript
26 lines
704 B
TypeScript
import MaterialIcon from '@/shared/components/material-icon'
|
|
import { IconTextButtonProps } from '../types/icon-text-button-props'
|
|
import Button from './button'
|
|
|
|
export default function IconTextButton({
|
|
children,
|
|
className,
|
|
leadingIcon,
|
|
size = 'default',
|
|
trailingIcon,
|
|
...props
|
|
}: IconTextButtonProps) {
|
|
const materialIconClassName = size === 'large' ? 'icon-large' : 'icon-small'
|
|
|
|
return (
|
|
<Button size={size} {...props}>
|
|
{leadingIcon && (
|
|
<MaterialIcon type={leadingIcon} className={materialIconClassName} />
|
|
)}
|
|
{children}
|
|
{trailingIcon && (
|
|
<MaterialIcon type={trailingIcon} className={materialIconClassName} />
|
|
)}
|
|
</Button>
|
|
)
|
|
}
|