material-icon.tsx 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. modifier?: string
  8. size?: '2x'
  9. }
  10. function MaterialIcon({
  11. type,
  12. className,
  13. accessibilityLabel,
  14. modifier,
  15. size,
  16. ...rest
  17. }: IconProps) {
  18. const iconClassName = classNames('material-symbols', className, modifier, {
  19. [`size-${size}`]: size,
  20. })
  21. return (
  22. <>
  23. <span className={iconClassName} aria-hidden="true" {...rest}>
  24. {type}
  25. </span>
  26. {accessibilityLabel && (
  27. <span className={bsVersion({ bs5: 'visually-hidden', bs3: 'sr-only' })}>
  28. {accessibilityLabel}
  29. </span>
  30. )}
  31. </>
  32. )
  33. }
  34. export default MaterialIcon