feat(layout-system basics): Added component-map, component-props, configloader and renderer.

Added vt-template for nav and poc example footer.
Added ste.medusa-starter.design.json.
Probable starting point (main)/layout.tsx refactored to use dynamic layout renderer instead of hardcoded template.
This commit is contained in:
2025-11-19 18:19:25 +01:00
parent b7c67b5834
commit 51d6ee2051
8 changed files with 367 additions and 21 deletions
+12 -21
View File
@@ -4,10 +4,9 @@ import { listCartOptions, retrieveCart } from "@lib/data/cart"
import { retrieveCustomer } from "@lib/data/customer"
import { getBaseURL } from "@lib/util/env"
import { StoreCartShippingOption } from "@medusajs/types"
import CartMismatchBanner from "@modules/layout/components/cart-mismatch-banner"
import Footer from "@modules/layout/templates/footer"
import Nav from "@modules/layout/templates/nav"
import FreeShippingPriceNudge from "@modules/shipping/components/free-shipping-price-nudge"
import { DynamicLayoutRenderer } from "../../../vibentec/renderer"
import { LayoutContext, LayoutComponentNode, } from "../../../vibentec/component-map"
import { loadDesignConfig } from "vibentec/configloader"
export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
@@ -24,22 +23,14 @@ export default async function PageLayout(props: { children: React.ReactNode }) {
shippingOptions = shipping_options
}
return (
<>
<Nav />
{customer && cart && (
<CartMismatchBanner customer={customer} cart={cart} />
)}
const nodes: LayoutComponentNode[] = await loadDesignConfig()
const context: LayoutContext = {
customer,
cart,
shippingOptions,
contentChildren: props.children,
}
{cart && (
<FreeShippingPriceNudge
variant="popup"
cart={cart}
shippingOptions={shippingOptions}
/>
)}
{props.children}
<Footer />
</>
)
return <DynamicLayoutRenderer nodes={nodes} context={context} />
}