material-icon.tsx 701 B

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