overleaf/services/web/frontend/js/shared/components/material-icon.tsx
Alexandre Bourdin 0c5ba1e96e Merge pull request #14491 from overleaf/ab-update-managed-users-icons
[web] Update managed users icons and improve display on smaller screen sizes

GitOrigin-RevId: 7b6263ea9afa9bb52bed3a3f50cbe361e7064085
2023-08-28 08:04:02 +00:00

38 lines
748 B
TypeScript

import classNames from 'classnames'
import React from 'react'
type IconOwnProps = {
type: string
category?: 'rounded' | 'outlined'
accessibilityLabel?: string
}
type IconProps = IconOwnProps &
Omit<React.ComponentProps<'i'>, keyof IconOwnProps>
function MaterialIcon({
type,
category = 'rounded',
className,
accessibilityLabel,
...rest
}: IconProps) {
const iconClassName = classNames(
'material-symbols',
`material-symbols-${category}`,
className
)
return (
<>
<span className={iconClassName} aria-hidden="true" {...rest}>
{type}
</span>
{accessibilityLabel && (
<span className="sr-only">{accessibilityLabel}</span>
)}
</>
)
}
export default MaterialIcon