|
1 | | -import React from 'react'; |
| 1 | +import cn from 'classnames'; |
2 | 2 |
|
3 | 3 | interface SpinnerProps { |
4 | 4 | size?: 'small' | 'default'; |
5 | 5 | } |
6 | 6 |
|
7 | 7 | const Spinner: React.FC<SpinnerProps> = ({ size = 'default' }) => { |
8 | | - const sizeFactor = size === 'default' ? '100px' : '50px'; |
| 8 | + const sizeFactor = size === 'default' ? 'w-32 h-32' : 'w-9 h-9'; |
| 9 | + |
9 | 10 | return ( |
10 | | - <img |
11 | | - src='/loader.gif' |
12 | | - alt='Loading...' |
13 | | - height={sizeFactor} |
14 | | - width={sizeFactor} |
15 | | - className='m-auto max-h-96' |
16 | | - /> |
| 11 | + <svg |
| 12 | + aria-label='Loading...' |
| 13 | + className={cn('block mx-auto animate-spin ', sizeFactor)} |
| 14 | + viewBox='0 0 100 100' |
| 15 | + > |
| 16 | + <rect |
| 17 | + fill='#555' |
| 18 | + height='6' |
| 19 | + opacity='0' |
| 20 | + rx='3' |
| 21 | + ry='3' |
| 22 | + transform='rotate(-90 50 50)' |
| 23 | + width='25' |
| 24 | + x='72' |
| 25 | + y='47' |
| 26 | + ></rect> |
| 27 | + <rect |
| 28 | + fill='#555' |
| 29 | + height='6' |
| 30 | + opacity='0.08333333333333333' |
| 31 | + rx='3' |
| 32 | + ry='3' |
| 33 | + transform='rotate(-60 50 50)' |
| 34 | + width='25' |
| 35 | + x='72' |
| 36 | + y='47' |
| 37 | + ></rect> |
| 38 | + <rect |
| 39 | + fill='#555' |
| 40 | + height='6' |
| 41 | + opacity='0.16666666666666666' |
| 42 | + rx='3' |
| 43 | + ry='3' |
| 44 | + transform='rotate(-30 50 50)' |
| 45 | + width='25' |
| 46 | + x='72' |
| 47 | + y='47' |
| 48 | + ></rect> |
| 49 | + <rect |
| 50 | + fill='#555' |
| 51 | + height='6' |
| 52 | + opacity='0.25' |
| 53 | + rx='3' |
| 54 | + ry='3' |
| 55 | + transform='rotate(0 50 50)' |
| 56 | + width='25' |
| 57 | + x='72' |
| 58 | + y='47' |
| 59 | + ></rect> |
| 60 | + <rect |
| 61 | + fill='#555' |
| 62 | + height='6' |
| 63 | + opacity='0.3333333333333333' |
| 64 | + rx='3' |
| 65 | + ry='3' |
| 66 | + transform='rotate(30 50 50)' |
| 67 | + width='25' |
| 68 | + x='72' |
| 69 | + y='47' |
| 70 | + ></rect> |
| 71 | + <rect |
| 72 | + fill='#555' |
| 73 | + height='6' |
| 74 | + opacity='0.4166666666666667' |
| 75 | + rx='3' |
| 76 | + ry='3' |
| 77 | + transform='rotate(60 50 50)' |
| 78 | + width='25' |
| 79 | + x='72' |
| 80 | + y='47' |
| 81 | + ></rect> |
| 82 | + <rect |
| 83 | + fill='#555' |
| 84 | + height='6' |
| 85 | + opacity='0.5' |
| 86 | + rx='3' |
| 87 | + ry='3' |
| 88 | + transform='rotate(90 50 50)' |
| 89 | + width='25' |
| 90 | + x='72' |
| 91 | + y='47' |
| 92 | + ></rect> |
| 93 | + <rect |
| 94 | + fill='#555' |
| 95 | + height='6' |
| 96 | + opacity='0.5833333333333334' |
| 97 | + rx='3' |
| 98 | + ry='3' |
| 99 | + transform='rotate(120 50 50)' |
| 100 | + width='25' |
| 101 | + x='72' |
| 102 | + y='47' |
| 103 | + ></rect> |
| 104 | + <rect |
| 105 | + fill='#555' |
| 106 | + height='6' |
| 107 | + opacity='0.6666666666666666' |
| 108 | + rx='3' |
| 109 | + ry='3' |
| 110 | + transform='rotate(150 50 50)' |
| 111 | + width='25' |
| 112 | + x='72' |
| 113 | + y='47' |
| 114 | + ></rect> |
| 115 | + <rect |
| 116 | + fill='#555' |
| 117 | + height='6' |
| 118 | + opacity='0.75' |
| 119 | + rx='3' |
| 120 | + ry='3' |
| 121 | + transform='rotate(180 50 50)' |
| 122 | + width='25' |
| 123 | + x='72' |
| 124 | + y='47' |
| 125 | + ></rect> |
| 126 | + <rect |
| 127 | + fill='#555' |
| 128 | + height='6' |
| 129 | + opacity='0.8333333333333334' |
| 130 | + rx='3' |
| 131 | + ry='3' |
| 132 | + transform='rotate(210 50 50)' |
| 133 | + width='25' |
| 134 | + x='72' |
| 135 | + y='47' |
| 136 | + ></rect> |
| 137 | + <rect |
| 138 | + fill='#555' |
| 139 | + height='6' |
| 140 | + opacity='0.9166666666666666' |
| 141 | + rx='3' |
| 142 | + ry='3' |
| 143 | + transform='rotate(240 50 50)' |
| 144 | + width='25' |
| 145 | + x='72' |
| 146 | + y='47' |
| 147 | + ></rect> |
| 148 | + </svg> |
17 | 149 | ); |
18 | 150 | }; |
19 | 151 |
|
|
0 commit comments