icon.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. >
  30. <defs>
  31. <linearGradient x1="0%" y1="100%" x2="100%" y2="100%" id={id}>
  32. <stop stopColor="currentColor" stopOpacity="0" offset="0%" />
  33. <stop stopColor="currentColor" stopOpacity="0.50" offset="39.9430698%" />
  34. <stop stopColor="currentColor" offset="100%" />
  35. </linearGradient>
  36. </defs>
  37. <g id="Artboard" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
  38. <rect id="Rectangle" fillOpacity="0.01" fill="#FFFFFF" x="0" y="0" width="36" height="36" />
  39. <path
  40. d="M34,18 C34,9.163444 26.836556,2 18,2 C11.6597233,2 6.18078805,5.68784135 3.59122325,11.0354951"
  41. id="Path"
  42. stroke={`url(#${id})`}
  43. strokeWidth="4"
  44. strokeLinecap="round"
  45. />
  46. </g>
  47. </svg>
  48. );
  49. }
  50. export default Icon;