loader.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { cn } from '@/lib/utils';
  2. import type { HTMLAttributes } from 'react';
  3. type LoaderIconProps = {
  4. size?: number;
  5. };
  6. const LoaderIcon = ({ size = 16 }: LoaderIconProps) => (
  7. <svg
  8. height={size}
  9. strokeLinejoin="round"
  10. style={{ color: 'currentcolor' }}
  11. viewBox="0 0 16 16"
  12. width={size}
  13. >
  14. <title>Loader</title>
  15. <g clipPath="url(#clip0_2393_1490)">
  16. <path d="M8 0V4" stroke="currentColor" strokeWidth="1.5" />
  17. <path d="M8 16V12" opacity="0.5" stroke="currentColor" strokeWidth="1.5" />
  18. <path
  19. d="M3.29773 1.52783L5.64887 4.7639"
  20. opacity="0.9"
  21. stroke="currentColor"
  22. strokeWidth="1.5"
  23. />
  24. <path
  25. d="M12.7023 1.52783L10.3511 4.7639"
  26. opacity="0.1"
  27. stroke="currentColor"
  28. strokeWidth="1.5"
  29. />
  30. <path
  31. d="M12.7023 14.472L10.3511 11.236"
  32. opacity="0.4"
  33. stroke="currentColor"
  34. strokeWidth="1.5"
  35. />
  36. <path
  37. d="M3.29773 14.472L5.64887 11.236"
  38. opacity="0.6"
  39. stroke="currentColor"
  40. strokeWidth="1.5"
  41. />
  42. <path
  43. d="M15.6085 5.52783L11.8043 6.7639"
  44. opacity="0.2"
  45. stroke="currentColor"
  46. strokeWidth="1.5"
  47. />
  48. <path
  49. d="M0.391602 10.472L4.19583 9.23598"
  50. opacity="0.7"
  51. stroke="currentColor"
  52. strokeWidth="1.5"
  53. />
  54. <path
  55. d="M15.6085 10.4722L11.8043 9.2361"
  56. opacity="0.3"
  57. stroke="currentColor"
  58. strokeWidth="1.5"
  59. />
  60. <path
  61. d="M0.391602 5.52783L4.19583 6.7639"
  62. opacity="0.8"
  63. stroke="currentColor"
  64. strokeWidth="1.5"
  65. />
  66. </g>
  67. <defs>
  68. <clipPath id="clip0_2393_1490">
  69. <rect fill="white" height="16" width="16" />
  70. </clipPath>
  71. </defs>
  72. </svg>
  73. );
  74. export type LoaderProps = HTMLAttributes<HTMLDivElement> & {
  75. size?: number;
  76. };
  77. export const Loader = ({ className, size = 16, ...props }: LoaderProps) => (
  78. <div className={cn('inline-flex animate-spin items-center justify-center', className)} {...props}>
  79. <LoaderIcon size={size} />
  80. </div>
  81. );