icon.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* eslint-disable no-unused-vars */
  2. import React from 'react';
  3. import isNullOrUndefined from '@douyinfe/semi-foundation/utils/isNullOrUndefined';
  4. let _id = -1;
  5. export interface IconProps {
  6. id?: number;
  7. component?: React.ReactNode;
  8. size?: number;
  9. className?: string;
  10. type?: string;
  11. }
  12. function Icon(props: IconProps = {}) {
  13. const { id: propsId, className, ...rest } = props;
  14. let _propsId = propsId;
  15. if (isNullOrUndefined(_propsId)) {
  16. _id++;
  17. _propsId = _id;
  18. }
  19. const id = `linearGradient-${_propsId}`;
  20. return (
  21. <svg
  22. {...rest}
  23. className={className}
  24. width="48"
  25. height="48"
  26. viewBox="0 0 36 36"
  27. version="1.1"
  28. xmlns="http://www.w3.org/2000/svg"
  29. aria-hidden
  30. data-icon="spin"
  31. >
  32. <defs>
  33. <linearGradient x1="0%" y1="100%" x2="100%" y2="100%" id={id}>
  34. <stop stopColor="currentColor" stopOpacity="0" offset="0%" />
  35. <stop stopColor="currentColor" stopOpacity="0.50" offset="39.9430698%" />
  36. <stop stopColor="currentColor" offset="100%" />
  37. </linearGradient>
  38. </defs>
  39. <g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
  40. <rect fillOpacity="0.01" fill="#FFFFFF" x="0" y="0" width="36" height="36" />
  41. <path
  42. d="M34,18 C34,9.163444 26.836556,2 18,2 C11.6597233,2 6.18078805,5.68784135 3.59122325,11.0354951"
  43. stroke={`url(#${id})`}
  44. strokeWidth="4"
  45. strokeLinecap="round"
  46. />
  47. </g>
  48. </svg>
  49. );
  50. }
  51. export default Icon;