overleaf/services/web/frontend/js/shared/components/material-icon.tsx
Alf Eaton 12326b420d Use sliced MaterialSymbolsRounded font (#16994)
GitOrigin-RevId: 51158acccc9967794b2192791961561d43274979
2024-02-16 09:04:36 +00:00

29 lines
578 B
TypeScript

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