index.tsx 805 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from 'react';
  2. import Svgs from 'svgs';
  3. import ReactSVG from 'react-svg';
  4. import MaterialIcon from '@material/react-material-icon';
  5. import '@material/react-material-icon/dist/material-icon.css';
  6. export type IconProps = {
  7. icon: string,
  8. className?: string,
  9. fill?: string,
  10. width?: number,
  11. height?: number,
  12. material?: boolean,
  13. }
  14. export function Icon({ width, height, fill, icon, className, material }: IconProps) {
  15. const styles = {
  16. width: width || 64,
  17. height: height || 'auto',
  18. fill: fill,
  19. };
  20. return material ? (
  21. <MaterialIcon icon={icon} className='material-icons-outlined' />
  22. ) : (
  23. <ReactSVG
  24. // @ts-ignore
  25. src={Svgs[icon]}
  26. className='cbk-icon'
  27. svgClassName={className}
  28. svgStyle={styles}
  29. />
  30. )
  31. }
  32. export default Icon;