Initial import of 1407 block sources under blocks/
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
import { Price, PriceValue } from "@/components/shadcnblocks/price";
|
||||
import { AspectRatio } from "@/components/ui/aspect-ratio";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardAction,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface ProductPrice {
|
||||
regular: number;
|
||||
sale?: number;
|
||||
currency: string;
|
||||
}
|
||||
|
||||
interface Product {
|
||||
name: string;
|
||||
image: {
|
||||
src: string;
|
||||
alt: string;
|
||||
};
|
||||
link: string;
|
||||
description: string;
|
||||
price: ProductPrice;
|
||||
badge: {
|
||||
text: string;
|
||||
backgroundColor?: string;
|
||||
};
|
||||
}
|
||||
|
||||
const PRODUCT_CARD: Product = {
|
||||
name: "کفش ورزشی وکسون کوراستپ ۰۸",
|
||||
image: {
|
||||
src: "/block-media/shadcnblocks/block/ecommerce/clothes/joshua-diaz-ETNoDLl8yFE-unsplash-1.jpg",
|
||||
alt: "کفش ورزشی وکسون کوراستپ",
|
||||
},
|
||||
link: "#",
|
||||
description:
|
||||
"راحتی روزمره با استایل جسورانه سهرنگ در این طراحی عملکردمحور.",
|
||||
price: {
|
||||
regular: 499000.0,
|
||||
sale: 399000.0,
|
||||
currency: "ریال",
|
||||
},
|
||||
badge: {
|
||||
text: "پرفروش!",
|
||||
backgroundColor: "oklch(50.5% 0.213 27.518)",
|
||||
},
|
||||
};
|
||||
|
||||
interface ProductCard2Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const ProductCard2 = ({ className }: ProductCard2Props) => {
|
||||
const { regular, sale, currency } = PRODUCT_CARD.price;
|
||||
|
||||
return (
|
||||
<div className={cn("flex w-full justify-center", className)}>
|
||||
<Card className="relative max-w-sm overflow-hidden p-0">
|
||||
<a
|
||||
href={PRODUCT_CARD.link}
|
||||
className="absolute inset-0 z-10 block size-full"
|
||||
></a>
|
||||
<CardHeader className="relative block p-0">
|
||||
<AspectRatio ratio={1.268115942} className="overflow-hidden">
|
||||
<img
|
||||
src={PRODUCT_CARD.image.src}
|
||||
alt={PRODUCT_CARD.image.alt}
|
||||
className="block size-full object-cover object-center"
|
||||
/>
|
||||
</AspectRatio>
|
||||
{PRODUCT_CARD.badge && (
|
||||
<Badge
|
||||
style={{
|
||||
background: PRODUCT_CARD.badge.backgroundColor,
|
||||
}}
|
||||
className="absolute start-4 top-4"
|
||||
>
|
||||
{PRODUCT_CARD.badge.text}
|
||||
</Badge>
|
||||
)}
|
||||
</CardHeader>
|
||||
<CardContent className="flex h-full flex-col gap-4">
|
||||
<CardTitle className="text-xl font-semibold">
|
||||
{PRODUCT_CARD.name}
|
||||
</CardTitle>
|
||||
<CardDescription className="font-medium text-muted-foreground">
|
||||
{PRODUCT_CARD.description}
|
||||
</CardDescription>
|
||||
<div className="mt-auto">
|
||||
<Price onSale={sale != null} className="text-lg font-semibold">
|
||||
<PriceValue price={regular} currency={currency} variant="regular" />
|
||||
<PriceValue price={sale} currency={currency} variant="sale" />
|
||||
</Price>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="pb-6">
|
||||
<CardAction className="w-full">
|
||||
<Button className="relative z-10 w-full">افزودن به سبد</Button>
|
||||
</CardAction>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { ProductCard2 };
|
||||
Reference in New Issue
Block a user