feat: clone product card and create design UI to map with json file

This commit is contained in:
Nam Doan
2025-12-22 14:12:43 +07:00
parent a2e5b56eb8
commit 6912f2605c
11 changed files with 399 additions and 11 deletions
+11 -1
View File
@@ -8,11 +8,19 @@ import { DynamicLayoutRenderer } from "../../../vibentec/renderer"
import { LayoutContext, LayoutComponentNode, } from "../../../vibentec/component-map"
import { loadDesignConfig } from "vibentec/configloader"
import { getRegion } from "@lib/data/regions"
export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
}
export default async function PageLayout(props: { children: React.ReactNode }) {
export default async function PageLayout(props: {
children: React.ReactNode
params: Promise<{ countryCode: string }>
}) {
const params = await props.params
const { countryCode } = params
const region = await getRegion(countryCode)
const customer = await retrieveCustomer()
const cart = await retrieveCart()
let shippingOptions: StoreCartShippingOption[] = []
@@ -29,6 +37,8 @@ export default async function PageLayout(props: { children: React.ReactNode }) {
cart,
shippingOptions,
contentChildren: props.children,
countryCode,
region,
}
+6 -7
View File
@@ -4,6 +4,7 @@ import FeaturedProducts from "@modules/home/components/featured-products"
import Hero from "@modules/home/components/hero"
import { listCollections } from "@lib/data/collections"
import { getRegion } from "@lib/data/regions"
import VtFeaturedProducts from "@modules/home/components/vt-featured-products"
export const metadata: Metadata = {
title: "Medusa Next.js Starter Template",
@@ -23,22 +24,20 @@ export default async function Home(props: {
const { collections } = await listCollections({
fields: "id, handle, title",
})
const res = await listCollections({
fields: "id, handle, title",
})
console.log('collections:',collections)
if (!collections || !region) {
return null
}
console.log(res, '--------------')
return (
<>
{/* <Hero /> */}
<div className="py-12">
{/* <div className="py-12">
<ul className="flex flex-col gap-x-6">
<FeaturedProducts collections={collections} region={region} />
<VtFeaturedProducts collections={collections} region={region} countryCode={countryCode} />
</ul>
</div>
</div> */}
</>
)
}