first commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import ProductRail from "@modules/home/components/featured-products/product-rail"
|
||||
|
||||
export default async function FeaturedProducts({
|
||||
collections,
|
||||
region,
|
||||
}: {
|
||||
collections: HttpTypes.StoreCollection[]
|
||||
region: HttpTypes.StoreRegion
|
||||
}) {
|
||||
return collections.map((collection) => (
|
||||
<li key={collection.id}>
|
||||
<ProductRail collection={collection} region={region} />
|
||||
</li>
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { listProducts } from "@lib/data/products"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Text } from "@modules/common/components/ui"
|
||||
|
||||
import InteractiveLink from "@modules/common/components/interactive-link"
|
||||
import ProductPreview from "@modules/products/components/product-preview"
|
||||
|
||||
export default async function ProductRail({
|
||||
collection,
|
||||
region,
|
||||
}: {
|
||||
collection: HttpTypes.StoreCollection
|
||||
region: HttpTypes.StoreRegion
|
||||
}) {
|
||||
const {
|
||||
response: { products: pricedProducts },
|
||||
} = await listProducts({
|
||||
regionId: region.id,
|
||||
queryParams: {
|
||||
collection_id: collection.id,
|
||||
fields: "*variants.calculated_price",
|
||||
},
|
||||
})
|
||||
|
||||
if (!pricedProducts) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="content-container py-12 small:py-24">
|
||||
<div className="flex justify-between mb-8">
|
||||
<Text className="txt-xlarge">{collection.title}</Text>
|
||||
<InteractiveLink href={`/collections/${collection.handle}`}>
|
||||
View all
|
||||
</InteractiveLink>
|
||||
</div>
|
||||
<ul className="grid grid-cols-2 small:grid-cols-3 gap-x-6 gap-y-24 small:gap-y-36">
|
||||
{pricedProducts &&
|
||||
pricedProducts.map((product) => (
|
||||
<li key={product.id}>
|
||||
<ProductPreview product={product} region={region} isFeatured />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Github } from "@medusajs/icons";
|
||||
import { Button, Heading } from "@modules/common/components/ui";
|
||||
const Hero = () => {
|
||||
return (
|
||||
<div className="h-[75vh] w-full border-b border-ui-border-base relative bg-ui-bg-subtle">
|
||||
<div className="absolute inset-0 z-10 flex flex-col justify-center items-center text-center small:p-32 gap-6">
|
||||
<span>
|
||||
<Heading
|
||||
level="h1"
|
||||
className="text-3xl leading-10 text-ui-fg-base font-normal"
|
||||
>
|
||||
Ecommerce Starter Template
|
||||
</Heading>
|
||||
<Heading
|
||||
level="h2"
|
||||
className="text-3xl leading-10 text-ui-fg-subtle font-normal"
|
||||
>
|
||||
Powered by Medusa and Next.js
|
||||
</Heading>
|
||||
</span>
|
||||
<a href="https://github.com/medusajs/dtc-starter" target="_blank">
|
||||
<Button variant="secondary">
|
||||
View on GitHub <Github />
|
||||
</Button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Hero;
|
||||
Reference in New Issue
Block a user