2024-02-17 08:16:16 +04:00
|
|
|
---
|
2024-02-18 07:39:17 +04:00
|
|
|
// Import necessary modules and utilities
|
2024-02-17 08:16:16 +04:00
|
|
|
import { Image } from "astro:assets";
|
2024-04-17 18:25:49 +04:00
|
|
|
import Icon from "@components/ui/icons/Icon.astro";
|
2024-02-17 08:16:16 +04:00
|
|
|
import type { CollectionEntry } from "astro:content";
|
2024-02-22 21:59:24 +04:00
|
|
|
|
2024-02-17 08:16:16 +04:00
|
|
|
const { product } = Astro.props;
|
2024-02-22 21:59:24 +04:00
|
|
|
|
2024-02-17 08:16:16 +04:00
|
|
|
interface Props {
|
|
|
|
|
product: CollectionEntry<"products">;
|
|
|
|
|
}
|
2024-02-18 07:39:17 +04:00
|
|
|
// Define classes to be used with the Image component
|
2024-02-17 08:16:16 +04:00
|
|
|
const imageClass =
|
|
|
|
|
"absolute inset-0 h-full w-full object-cover object-center transition duration-[600ms] ease-[cubic-bezier(0.45,0,0.55,1)] group-hover:scale-110";
|
|
|
|
|
---
|
|
|
|
|
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The anchor tag is the main container for the product card. When clicked, this leads to the details of the product. -->
|
2024-02-17 08:16:16 +04:00
|
|
|
<a
|
|
|
|
|
href={"/products/" + product.slug}
|
|
|
|
|
data-astro-prefetch
|
|
|
|
|
class="group relative flex h-48 items-end overflow-hidden rounded-lg shadow-xl outline-none ring-zinc-500 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none md:col-span-2 md:h-80"
|
|
|
|
|
>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- The product's main image -->
|
2024-02-17 08:16:16 +04:00
|
|
|
<Image
|
|
|
|
|
src={product.data.main.imgCard}
|
|
|
|
|
alt={product.data.main.imgAlt}
|
|
|
|
|
draggable={"false"}
|
|
|
|
|
class={imageClass}
|
|
|
|
|
format={"avif"}
|
|
|
|
|
/>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- This container includes a gradient overlay over the product's image -->
|
2024-02-17 08:16:16 +04:00
|
|
|
<div
|
|
|
|
|
class="pointer-events-none absolute inset-0 bg-gradient-to-t from-neutral-800 via-transparent to-transparent opacity-50"
|
|
|
|
|
>
|
|
|
|
|
</div>
|
2024-02-18 07:39:17 +04:00
|
|
|
<!-- This container includes product's subtitle and an SVG icon-->
|
2024-02-17 08:16:16 +04:00
|
|
|
<span
|
|
|
|
|
class="relative mb-3 ml-4 inline-block text-sm font-bold text-neutral-50 transition duration-[600ms] ease-[cubic-bezier(0.45,0,0.55,1)] group-hover:scale-110 md:ml-5 md:text-lg"
|
2024-03-30 14:51:44 +04:00
|
|
|
>{product.data.description} <Icon name="openInNew" /></span
|
2024-02-17 08:16:16 +04:00
|
|
|
>
|
|
|
|
|
</a>
|