material-icon.tsx 578 B

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