|
| 1 | +import React from 'react'; |
| 2 | + |
| 3 | +export interface FallbackProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {} |
| 4 | +const defaultStyle: React.CSSProperties = { |
| 5 | + display: 'flex', |
| 6 | + alignItems: 'center', |
| 7 | + justifyContent: 'center', |
| 8 | + gap: '1rem', |
| 9 | + left: 0, |
| 10 | + right: 0, |
| 11 | + top: 0, |
| 12 | + bottom: 0, |
| 13 | + position: 'absolute', |
| 14 | + zIndex: 9999, |
| 15 | +}; |
| 16 | + |
| 17 | +export const Fallback = ({ children, style, ...other }: FallbackProps) => ( |
| 18 | + <div {...other} style={{ ...defaultStyle, ...style }}> |
| 19 | + <svg width="25" height="30" viewBox="0 0 135 140" fill="currentColor"> |
| 20 | + <rect y="10" width="15" height="120" rx="6"> |
| 21 | + <animate |
| 22 | + attributeName="height" |
| 23 | + begin="0.5s" |
| 24 | + dur="1s" |
| 25 | + values="120;110;100;90;80;70;60;50;40;140;120" |
| 26 | + calcMode="linear" |
| 27 | + repeatCount="indefinite" |
| 28 | + /> |
| 29 | + <animate |
| 30 | + attributeName="y" |
| 31 | + begin="0.5s" |
| 32 | + dur="1s" |
| 33 | + values="10;15;20;25;30;35;40;45;50;0;10" |
| 34 | + calcMode="linear" |
| 35 | + repeatCount="indefinite" |
| 36 | + /> |
| 37 | + </rect> |
| 38 | + <rect x="30" y="10" width="15" height="120" rx="6"> |
| 39 | + <animate |
| 40 | + attributeName="height" |
| 41 | + begin="0.25s" |
| 42 | + dur="1s" |
| 43 | + values="120;110;100;90;80;70;60;50;40;140;120" |
| 44 | + calcMode="linear" |
| 45 | + repeatCount="indefinite" |
| 46 | + /> |
| 47 | + <animate |
| 48 | + attributeName="y" |
| 49 | + begin="0.25s" |
| 50 | + dur="1s" |
| 51 | + values="10;15;20;25;30;35;40;45;50;0;10" |
| 52 | + calcMode="linear" |
| 53 | + repeatCount="indefinite" |
| 54 | + /> |
| 55 | + </rect> |
| 56 | + <rect x="60" width="15" height="140" rx="6"> |
| 57 | + <animate |
| 58 | + attributeName="height" |
| 59 | + begin="0s" |
| 60 | + dur="1s" |
| 61 | + values="120;110;100;90;80;70;60;50;40;140;120" |
| 62 | + calcMode="linear" |
| 63 | + repeatCount="indefinite" |
| 64 | + /> |
| 65 | + <animate |
| 66 | + attributeName="y" |
| 67 | + begin="0s" |
| 68 | + dur="1s" |
| 69 | + values="10;15;20;25;30;35;40;45;50;0;10" |
| 70 | + calcMode="linear" |
| 71 | + repeatCount="indefinite" |
| 72 | + /> |
| 73 | + </rect> |
| 74 | + <rect x="90" y="10" width="15" height="120" rx="6"> |
| 75 | + <animate |
| 76 | + attributeName="height" |
| 77 | + begin="0.25s" |
| 78 | + dur="1s" |
| 79 | + values="120;110;100;90;80;70;60;50;40;140;120" |
| 80 | + calcMode="linear" |
| 81 | + repeatCount="indefinite" |
| 82 | + /> |
| 83 | + <animate |
| 84 | + attributeName="y" |
| 85 | + begin="0.25s" |
| 86 | + dur="1s" |
| 87 | + values="10;15;20;25;30;35;40;45;50;0;10" |
| 88 | + calcMode="linear" |
| 89 | + repeatCount="indefinite" |
| 90 | + /> |
| 91 | + </rect> |
| 92 | + <rect x="120" y="10" width="15" height="120" rx="6"> |
| 93 | + <animate |
| 94 | + attributeName="height" |
| 95 | + begin="0.5s" |
| 96 | + dur="1s" |
| 97 | + values="120;110;100;90;80;70;60;50;40;140;120" |
| 98 | + calcMode="linear" |
| 99 | + repeatCount="indefinite" |
| 100 | + /> |
| 101 | + <animate |
| 102 | + attributeName="y" |
| 103 | + begin="0.5s" |
| 104 | + dur="1s" |
| 105 | + values="10;15;20;25;30;35;40;45;50;0;10" |
| 106 | + calcMode="linear" |
| 107 | + repeatCount="indefinite" |
| 108 | + /> |
| 109 | + </rect> |
| 110 | + </svg> |
| 111 | + <div>{children || 'Loading...'}</div> |
| 112 | + </div> |
| 113 | +); |
0 commit comments