import { Rating } from "@/components/shadcnblocks/rating"; import { Button } from "@/components/ui/button"; import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { cn } from "@/lib/utils"; interface Product { name: string; brand: string; image: { src: string; alt: string; }; link: string; price: ProductPrice; rate: number; } interface PromoCard { image: string; title: string; cta: { label: string; link: string; }; tagline: string; } type PromoCardProps = PromoCard; type ProductCardProps = Product; interface ProductPrice { regular: number; sale?: number; currency: string; } type ProductList = Array; const PROMO_CARD: PromoCard = { image: "/block-media/shadcnblocks/block/ecommerce/clothes/Summer-Fashion-Duo-1.png", title: "کالکشن مد تابستانه", tagline: "لایه‌های سبک، اثر پررنگ.", cta: { label: "مشاهده تازه‌ها", link: "#", }, }; const PRODUCTS_LIST: ProductList = [ { image: { src: "/block-media/shadcnblocks/block/ecommerce/clothes/Sporty-Casual-Portrait-1.png", alt: "تاپ کراپ صورتی با طراحی شیک", }, name: "تاپ کراپ رز کات", brand: "آتلیه رزه", link: "#", price: { regular: 590000.0, currency: "ریال", }, rate: 5, }, { image: { src: "/block-media/shadcnblocks/block/ecommerce/clothes/Woman-in-Embroidered-Blue-Top-1.png", alt: "پیراهن آبی آستین‌کوتاه گلدوزی‌شده", }, name: "بلوز آستین‌کوتاه آژور بلوم", brand: "آتلیه رزه", link: "#", price: { regular: 780000.0, sale: 600000.0, currency: "ریال", }, rate: 4, }, { image: { src: "/block-media/shadcnblocks/block/ecommerce/clothes/Person-in-Activewear-1.png", alt: "تاپ ورزشی سبز", }, name: "تاپ ورزشی پالس‌فلکس", brand: "رزه اکتیو", link: "#", price: { regular: 790000.0, currency: "ریال", }, rate: 4, }, ]; interface ProductList4Props { className?: string; } const ProductList4 = ({ className }: ProductList4Props) => { return (
{PRODUCTS_LIST.map((item, index) => ( ))}
); }; const PromoCard = ({ image, title, cta, tagline }: PromoCardProps) => { return ( {title} {tagline} ); }; const ProductCard = ({ name, link, image, price, brand, rate, }: ProductCardProps) => { const { regular, sale, currency } = price; return (
{image.alt}
{brand}
{name}
); }; const formatCurrency = ( value: number, currency: string = "ریال", locale: string = "fa-IR", ) => { return `${value.toLocaleString(locale)} ${currency}`; }; const ProductCardPrice = ({ regular, sale, currency, }: { regular: number; sale?: number; currency: string; }) => { const onSale = sale != null; return (
{formatCurrency(regular, currency)} {onSale ? ( {formatCurrency(sale, currency)} ) : null}
); }; export { ProductList4 };