Vitron-Front/app/components/SellerTilesGrid.tsx
fazli e60a03ac65 feat(seller-tiles): remove seller name overlay on desktop grid
The homepage seller tiles now show just the shop image on all breakpoints.
The desktop-only bottom gradient + name label was making some brand images
harder to read; the shop click target is unchanged and username is still
available on hover-tap navigation to /seller/<username>.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-01 09:15:42 +00:00

105 lines
2.8 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 { Link } from "@remix-run/react";
import { ChevronLeft, Store } from "lucide-react";
import { Skeleton } from "./ui/skeleton";
import { ErrorState } from "./UiProvider";
interface SellerTile {
id?: string;
sellerId?: string;
sellerUsername?: string;
sellerName?: string;
imageUrl?: string;
order?: number;
}
interface SellerTilesGridProps {
sellers: SellerTile[];
isLoading: boolean;
isError: boolean;
refetch: () => void;
showViewAllButton?: boolean;
}
const SellerTilesGrid = ({
sellers,
isLoading,
isError,
refetch,
showViewAllButton = true,
}: SellerTilesGridProps) => {
if (isLoading) {
return <SellerTilesSkeleton />;
}
if (isError) {
return (
<div className="px-4">
<ErrorState onRetry={refetch} />
</div>
);
}
if (sellers.length === 0) {
return null;
}
return (
<div className="w-full flex flex-col gap-4 px-4 lg:px-0">
{/* 2x2 on mobile, single row of 5 on desktop */}
<div className="grid grid-cols-2 lg:grid-cols-5 gap-2 lg:gap-4">
{sellers.slice(0, 5).map((seller, index) => (
<Link
key={seller.id || index}
to={`/seller/${seller.sellerUsername}`}
className={`relative aspect-square overflow-hidden rounded-lg group ${
index === 4 ? "hidden lg:block" : ""
}`}
>
{/* Background Image */}
{seller.imageUrl ? (
<img
src={seller.imageUrl}
alt={seller.sellerName || "فروشگاه"}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
/>
) : (
<div className="w-full h-full bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center">
<Store size={48} className="text-gray-400" />
</div>
)}
</Link>
))}
</div>
{/* View All Button */}
{showViewAllButton && (
<Link
to="/sellers"
className="flex items-center justify-center gap-2 w-full py-3 border border-black rounded-none hover:bg-black hover:text-white transition-colors duration-300"
>
<span className="text-B14 font-bold">مشاهده همه فروشگاهها</span>
<ChevronLeft size={18} />
</Link>
)}
</div>
);
};
const SellerTilesSkeleton = () => {
return (
<div className="w-full flex flex-col gap-4 px-4">
<div className="grid grid-cols-2 gap-2">
{Array(4)
.fill(1)
.map((_, index) => (
<Skeleton key={index} className="aspect-square rounded-lg" />
))}
</div>
<Skeleton className="w-full h-12 rounded-none" />
</div>
);
};
export default SellerTilesGrid;