material-icon.tsx 622 B

12345678910111213141516171819202122232425262728293031
  1. import classNames from 'classnames'
  2. type IconOwnProps = {
  3. type: string
  4. accessibilityLabel?: string
  5. }
  6. type IconProps = IconOwnProps &
  7. Omit<React.ComponentProps<'i'>, keyof IconOwnProps>
  8. function MaterialIcon({
  9. type,
  10. className,
  11. accessibilityLabel,
  12. ...rest
  13. }: IconProps) {
  14. const iconClassName = classNames('material-symbols-rounded', className)
  15. return (
  16. <>
  17. <span className={iconClassName} aria-hidden="true" {...rest}>
  18. {type}
  19. </span>
  20. {accessibilityLabel && (
  21. <span className="sr-only">{accessibilityLabel}</span>
  22. )}
  23. </>
  24. )
  25. }
  26. export default MaterialIcon