index.tsx
3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from 'react'
import './style.css'
import { SkeletonContainer, SkeletonPoint, SkeletonRectangle, SkeletonRow } from '../skeleton'
type LoadingType = 'app' | 'skeleton'
const Loading: React.FC<{ type?: LoadingType }> = ({ type = 'app' }) => {
if (type === 'app') {
return (
<div className={`flex w-full items-center justify-center ${type === 'app' ? 'h-full' : ''}`}>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="spin-animation">
<g clipPath="url(#clip0_324_2488)">
<path
d="M15 0H10C9.44772 0 9 0.447715 9 1V6C9 6.55228 9.44772 7 10 7H15C15.5523 7 16 6.55228 16 6V1C16 0.447715 15.5523 0 15 0Z"
fill="#1C64F2"
/>
<path
opacity="0.5"
d="M15 9H10C9.44772 9 9 9.44772 9 10V15C9 15.5523 9.44772 16 10 16H15C15.5523 16 16 15.5523 16 15V10C16 9.44772 15.5523 9 15 9Z"
fill="#1C64F2"
/>
<path
opacity="0.1"
d="M6 9H1C0.447715 9 0 9.44772 0 10V15C0 15.5523 0.447715 16 1 16H6C6.55228 16 7 15.5523 7 15V10C7 9.44772 6.55228 9 6 9Z"
fill="#1C64F2"
/>
<path
opacity="0.2"
d="M6 0H1C0.447715 0 0 0.447715 0 1V6C0 6.55228 0.447715 7 1 7H6C6.55228 7 7 6.55228 7 6V1C7 0.447715 6.55228 0 6 0Z"
fill="#1C64F2"
/>
</g>
<defs>
<clipPath id="clip0_324_2488">
<rect width="16" height="16" fill="white" />
</clipPath>
</defs>
</svg>
</div>
)
} else {
return (
<SkeletonContainer className="mx-auto max-w-3xl space-y-10 mt-12">
{/* AI */}
<SkeletonRow className="flex justify-start items-start gap-4">
<SkeletonPoint className="w-10 h-10 rounded-full bg-gray-400" />
<div className="flex-1 space-y-2 max-w-[90%]">
<SkeletonRectangle className="w-full h-6 bg-gray-300 rounded-lg" />
<SkeletonRectangle className="w-[90%] h-6 bg-gray-300 rounded-lg" />
<SkeletonRectangle className="w-[80%] h-6 bg-gray-300 rounded-lg" />
</div>
</SkeletonRow>
{/* 用户 */}
<SkeletonRow className="flex justify-end items-start gap-4">
<div className="flex-1 space-y-2 max-w-[90%]">
<SkeletonRectangle className="w-[60%] h-6 bg-blue-300 rounded-lg ml-auto" />
<SkeletonRectangle className="w-[50%] h-6 bg-blue-300 rounded-lg ml-auto" />
</div>
<SkeletonPoint className="w-10 h-10 rounded-full bg-blue-400" />
</SkeletonRow>
{/* AI */}
<SkeletonRow className="flex justify-start items-start gap-4">
<SkeletonPoint className="w-10 h-10 rounded-full bg-gray-400" />
<SkeletonRectangle className="w-[30%] h-6 bg-gray-300 rounded-lg animate-pulse" />
</SkeletonRow>
</SkeletonContainer>
)
}
}
export default Loading