changed some styles

This commit is contained in:
@jcarymuhammedow
2026-02-06 18:52:48 +05:00
parent f32e7538e1
commit 022c7290b4
11 changed files with 190 additions and 146 deletions

View File

@@ -22,24 +22,42 @@ export default function CategoryGrid({
}: Props) {
if (isError) {
return (
<section className="bg-white rounded-2xl shadow-sm p-6">
<h2 className="text-xl font-semibold mb-4">{title}</h2>
<p className="text-red-600">
Failed to load categories. Please try again.
</p>
<section className="bg-white rounded-3xl shadow-sm border border-gray-100 p-8">
<h2 className="text-2xl font-bold mb-6 text-gray-900">{title}</h2>
<div className="text-center py-8">
<div className="inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-50 mb-4">
<svg
className="w-6 h-6 text-red-600"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
<p className="text-gray-900 font-semibold text-lg mb-2">
Failed to load categories
</p>
<p className="text-gray-500">Please refresh the page and try again</p>
</div>
</section>
);
}
if (isLoading) {
return (
<section className="bg-white rounded-2xl shadow-sm p-6">
<h2 className="text-xl font-semibold mb-4">{title}</h2>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4">
{Array.from({ length: 10 }).map((_, i) => (
<div key={i} className="space-y-2">
<Skeleton className="w-full h-36 rounded-lg" />
<Skeleton className="h-4 w-full" />
<section className="bg-white rounded-3xl shadow-sm border border-gray-100 p-8">
<Skeleton className="h-9 w-56 mb-6 rounded-xl" />
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-5">
{Array.from({ length: 12 }).map((_, i) => (
<div key={i} className="space-y-3">
<Skeleton className="w-full h-36 rounded-2xl" />
<Skeleton className="h-4 w-full rounded-lg" />
</div>
))}
</div>
@@ -48,27 +66,28 @@ export default function CategoryGrid({
}
return (
<section className="bg-white rounded-2xl shadow-sm p-6">
<h2 className="text-xl font-semibold mb-4">{title}</h2>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4">
<section className="bg-white rounded-lg shadow-sm border border-gray-100 p-2 md:p-6">
<h2 className="text-2xl font-bold mb-6 text-gray-900">{title}</h2>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-5">
{categories?.map((cat) => (
<Link
key={cat.id}
href={`/${locale}/category/${cat.slug}?category_id=${cat.id}`}
className="group"
>
<Card className="hover:shadow-md border-none shadow-none p-0 gap-2 transition-all cursor-pointer">
<div className="relative w-full h-36 overflow-hidden rounded-lg">
<Card className="border p-2 border-gray-100 hover:border-gray-900 hover:shadow-lg transition-all duration-300 cursor-pointer overflow-hidden rounded-lg bg-gradient-to-br from-gray-50 to-white">
<div className="relative w-full h-40 overflow-hidden bg-gradient-to-br from-gray-50 to-gray-100">
<Image
src={
cat.media[0]?.thumbnail || cat.media?.[0]?.images_400x400
cat.media[0]?.thumbnail || cat.media?.[0]?.images_800x800
}
alt={cat.name}
fill
className="object-contain"
className="object-cover transition-transform duration-500 group-hover:scale-110"
/>
</div>
<CardContent className="py-2">
<p className="text-sm font-medium text-gray-800 truncate text-center">
<CardContent className="py-4 px-3">
<p className="text-sm font-semibold text-gray-900 truncate text-center group-hover:text-gray-700 transition-colors">
{cat.name}
</p>
</CardContent>
@@ -78,4 +97,4 @@ export default function CategoryGrid({
</div>
</section>
);
}
}