39420-vm/src/components/ModGrid.tsx
gpt-engineer-app[bot] d74c5a27a9 Added Supabase integration setup
Co-authored-by: felix-fx-top <253056634+felix-fx-top@users.noreply.github.com>
2026-03-29 15:30:13 +00:00

68 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import ModCard from "./ModCard";
import { Skeleton } from "@/components/ui/skeleton";
interface Mod {
id: string;
slug: string;
title: string;
description: string;
icon_url?: string;
downloads: number;
followers: number;
categories: string[];
project_type: string;
}
interface ModGridProps {
mods: Mod[];
isLoading?: boolean;
title?: string;
}
const ModGrid = ({ mods, isLoading, title }: ModGridProps) => {
return (
<section className="py-8">
{title && (
<h2 className="mb-6 text-2xl font-bold">{title}</h2>
)}
{isLoading ? (
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 6 }).map((_, i) => (
<div key={i} className="flex gap-4 rounded-lg border border-border bg-card p-4">
<Skeleton className="h-16 w-16 shrink-0 rounded-lg" />
<div className="flex-1 space-y-2">
<Skeleton className="h-5 w-3/4" />
<Skeleton className="h-4 w-full" />
<Skeleton className="h-3 w-1/2" />
</div>
</div>
))}
</div>
) : mods.length === 0 ? (
<div className="py-12 text-center text-muted-foreground">
لا توجد إضافات حالياً
</div>
) : (
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{mods.map((mod) => (
<ModCard
key={mod.id}
id={mod.id}
slug={mod.slug}
title={mod.title}
description={mod.description}
iconUrl={mod.icon_url}
downloads={mod.downloads}
followers={mod.followers}
categories={mod.categories || []}
projectType={mod.project_type}
/>
))}
</div>
)}
</section>
);
};
export default ModGrid;