Spaces:
Sleeping
Sleeping
File size: 6,523 Bytes
f46e5bb | 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | import React from 'react';
import styles from './skeleton.module.css';
export function SkeletonBox({ width = '100%', height = '20px', marginBottom = '12px', borderRadius = '8px' }) {
return (
<div
className={styles.skeleton}
style={{
width,
height,
marginBottom,
borderRadius,
}}
/>
);
}
export function SkeletonCard({ className = '', children = null }) {
return (
<div className={`${styles.skeletonCard} ${className}`}>
{children || (
<>
<SkeletonBox height="24px" marginBottom="16px" />
<SkeletonBox height="16px" marginBottom="8px" />
<SkeletonBox height="16px" marginBottom="8px" width="80%" />
</>
)}
</div>
);
}
export function SkeletonText({ lines = 3, width = '100%' }) {
return (
<>
{Array(lines).fill(null).map((_, i) => (
<SkeletonBox
key={i}
width={i === lines - 1 ? '80%' : width}
height="16px"
marginBottom="8px"
/>
))}
</>
);
}
export function DashboardPageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Overview Cards */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '16px', marginBottom: '32px' }}>
{Array(4).fill(null).map((_, i) => (
<SkeletonCard key={i}>
<SkeletonBox height="16px" marginBottom="12px" width="60%" />
<SkeletonBox height="32px" marginBottom="8px" />
<SkeletonBox height="12px" width="70%" />
</SkeletonCard>
))}
</div>
{/* Featured Players */}
<div style={{ marginBottom: '32px' }}>
<SkeletonBox height="24px" marginBottom="16px" width="30%" />
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px' }}>
{Array(3).fill(null).map((_, i) => (
<SkeletonCard key={i} />
))}
</div>
</div>
{/* Charts */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '16px' }}>
{Array(2).fill(null).map((_, i) => (
<SkeletonCard key={i}>
<SkeletonBox height="300px" marginBottom="0" />
</SkeletonCard>
))}
</div>
</div>
);
}
export function PlayersPageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Filters and Search */}
<div style={{ marginBottom: '24px', display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '12px' }}>
{Array(4).fill(null).map((_, i) => (
<SkeletonBox key={i} height="40px" marginBottom="0" />
))}
</div>
{/* Players List */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '16px' }}>
{Array(8).fill(null).map((_, i) => (
<SkeletonCard key={i} />
))}
</div>
</div>
);
}
export function FinancePageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Summary Cards */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px', marginBottom: '32px' }}>
{Array(3).fill(null).map((_, i) => (
<SkeletonCard key={i}>
<SkeletonBox height="16px" marginBottom="12px" width="60%" />
<SkeletonBox height="32px" marginBottom="8px" />
<SkeletonBox height="12px" width="70%" />
</SkeletonCard>
))}
</div>
{/* Transactions List */}
<div>
<SkeletonBox height="24px" marginBottom="16px" width="30%" />
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
{Array(5).fill(null).map((_, i) => (
<SkeletonBox key={i} height="60px" marginBottom="0" />
))}
</div>
</div>
</div>
);
}
export function AdminPageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Stats Cards */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '16px', marginBottom: '32px' }}>
{Array(4).fill(null).map((_, i) => (
<SkeletonCard key={i} />
))}
</div>
{/* Users Table */}
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
<SkeletonBox height="20px" marginBottom="16px" width="30%" />
{Array(10).fill(null).map((_, i) => (
<SkeletonBox key={i} height="50px" marginBottom="0" />
))}
</div>
</div>
);
}
export function MatchesPageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Matches List */}
<SkeletonBox height="24px" marginBottom="16px" width="30%" />
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px', marginBottom: '32px' }}>
{Array(5).fill(null).map((_, i) => (
<SkeletonBox key={i} height="80px" marginBottom="0" />
))}
</div>
{/* Scoreboard */}
<div>
<SkeletonBox height="24px" marginBottom="16px" width="30%" />
<SkeletonCard>
<SkeletonBox height="300px" marginBottom="0" />
</SkeletonCard>
</div>
</div>
);
}
export function ProfilePageSkeleton() {
return (
<div style={{ padding: '24px' }}>
{/* Profile Header */}
<div style={{ display: 'flex', gap: '24px', marginBottom: '32px', alignItems: 'center' }}>
<SkeletonBox width="120px" height="120px" borderRadius="50%" marginBottom="0" />
<div style={{ flex: 1 }}>
<SkeletonBox height="32px" marginBottom="12px" width="50%" />
<SkeletonBox height="16px" marginBottom="8px" width="70%" />
<SkeletonBox height="16px" marginBottom="0" width="40%" />
</div>
</div>
{/* Stats Grid */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '16px', marginBottom: '32px' }}>
{Array(6).fill(null).map((_, i) => (
<SkeletonCard key={i} />
))}
</div>
{/* Tabs Content */}
<div>
<SkeletonBox height="20px" marginBottom="16px" width="30%" />
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
{Array(3).fill(null).map((_, i) => (
<SkeletonBox key={i} height="60px" marginBottom="0" />
))}
</div>
</div>
</div>
);
}
|