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