Spaces:
Runtime error
Runtime error
File size: 1,854 Bytes
5463318 | 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 | import React from "react";
import { cn } from "../../utils/cn";
import { motion } from "framer-motion";
export function Skeleton({ className, ...props }) {
return (
<div
className={cn("animate-pulse rounded-md bg-muted/60 dark:bg-muted", className)}
{...props}
/>
);
}
// Shimmer Advanced variants
export function Shimmer({ className }) {
return (
<div className={cn("relative overflow-hidden rounded-md bg-muted/60 dark:bg-muted", className)}>
<motion.div
className="absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/20 to-transparent dark:via-white/5"
animate={{ translateX: ["-100%", "200%"] }}
transition={{ repeat: Infinity, duration: 1.5, ease: "easeInOut" }}
/>
</div>
);
}
export function CardSkeleton() {
return (
<div className="rounded-xl border border-border p-6 flex flex-col shadow-sm bg-card h-full">
<div className="flex justify-between items-center mb-2">
<Shimmer className="h-4 w-1/2 rounded" />
<Shimmer className="h-5 w-5 rounded-full" />
</div>
<div className="mt-4 flex flex-col gap-2">
<Shimmer className="h-8 w-1/3 rounded" />
<Shimmer className="h-3 w-1/2 rounded" />
</div>
</div>
);
}
export function TableRowSkeleton() {
return (
<div className="flex items-center space-x-4 border-b border-border p-4">
<Shimmer className="h-5 w-1/4 rounded" />
<Shimmer className="h-5 w-1/4 rounded" />
<Shimmer className="h-5 w-1/4 rounded" />
<Shimmer className="h-5 w-1/4 rounded" />
<Shimmer className="h-8 w-8 rounded-full" />
</div>
);
}
|