Compare commits
2 Commits
3e5a88f42d
...
c8853bac1c
| Author | SHA1 | Date |
|---|---|---|
|
|
c8853bac1c | |
|
|
60700ee11e |
|
|
@ -0,0 +1,90 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Header": {
|
||||||
|
"config": {
|
||||||
|
"sticky": true,
|
||||||
|
"variant": "ticker"
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"Banner": {
|
||||||
|
"config": {
|
||||||
|
"variant": "ticker",
|
||||||
|
"className": "h-12 bg-[#009b93] text-[#fff] gap-12",
|
||||||
|
"speed": 24,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"Link": {
|
||||||
|
"config": {
|
||||||
|
"label": "NEU: Overnight Oats – Sallys Nussecke 😍",
|
||||||
|
"href": "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Link": {
|
||||||
|
"config": {
|
||||||
|
"label": "Versandkostenfrei ab 45 € 💛",
|
||||||
|
"href": "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Link": {
|
||||||
|
"config": {
|
||||||
|
"label": "Gratis Geschenk ab 60 € Warenkorbwert 🎁",
|
||||||
|
"href": "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Nav": {
|
||||||
|
"config": {
|
||||||
|
"className": "h-12 bg-white text-[#003F31] gap-12",
|
||||||
|
"left": [
|
||||||
|
{
|
||||||
|
"Image": {
|
||||||
|
"config": {
|
||||||
|
"src": "/3bear-logo.png",
|
||||||
|
"alt": "MyShop",
|
||||||
|
"className": "h-[150px] w-[180px]",
|
||||||
|
"objectFit": "contain"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"CartMismatchBanner": {
|
||||||
|
"config": {
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"FreeShippingPriceNudge": {
|
||||||
|
"config": {
|
||||||
|
"variant": "popup"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"PropsChildren": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Footer": {
|
||||||
|
"config": {
|
||||||
|
"copyrightText": "© 2025 MyShop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
Binary file not shown.
|
|
@ -2,8 +2,13 @@ import LocalizedClientLink from "@modules/common/components/localized-client-lin
|
||||||
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
||||||
import { clx } from "@medusajs/ui"
|
import { clx } from "@medusajs/ui"
|
||||||
|
|
||||||
|
interface VtLinkProps {
|
||||||
|
className?: string
|
||||||
|
href?: string
|
||||||
|
label?: string
|
||||||
|
}
|
||||||
export const VtLink = ({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) => {
|
export const VtLink = ({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) => {
|
||||||
const props = nodes.config ?? {}
|
const props = nodes.config as VtLinkProps ?? {}
|
||||||
const className = clx("txt-compact-xlarge-plus hover:text-ui-fg-base", props.className)
|
const className = clx("txt-compact-xlarge-plus hover:text-ui-fg-base", props.className)
|
||||||
const href = props.href ?? "/"
|
const href = props.href ?? "/"
|
||||||
const label = props.label ?? "Medusa Store"
|
const label = props.label ?? "Medusa Store"
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,15 @@ interface BannerCTAProps {
|
||||||
context: LayoutContext
|
context: LayoutContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface BannerConfigProps {
|
||||||
|
text?: string
|
||||||
|
href?: string
|
||||||
|
iconLeft?: string
|
||||||
|
iconRight?: string
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
export default function BannerCTA({ node, context }: BannerCTAProps) {
|
export default function BannerCTA({ node, context }: BannerCTAProps) {
|
||||||
const props = node.config ?? {}
|
const props = node.config as BannerConfigProps ?? {}
|
||||||
const text = props.text ?? ""
|
const text = props.text ?? ""
|
||||||
const href = props.href ?? undefined
|
const href = props.href ?? undefined
|
||||||
const iconLeft = props.iconLeft
|
const iconLeft = props.iconLeft
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
||||||
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
||||||
|
|
||||||
export default function BannerNav({ node: node, context }: { node: LayoutComponentDefinition; context: LayoutContext }) {
|
interface BannerNavProps {
|
||||||
const props = node.config ?? {};
|
left?: LayoutComponentDefinition[]
|
||||||
|
center?: LayoutComponentDefinition[]
|
||||||
|
right?: LayoutComponentDefinition[]
|
||||||
|
}
|
||||||
|
export default function BannerNav({ node, context }: { node: LayoutComponentDefinition; context: LayoutContext }) {
|
||||||
|
const props = node.config as BannerNavProps ?? {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="content-container txt-xsmall-plus text-ui-fg-subtle flex items-center justify-between w-full h-full text-small-regular">
|
<nav className="content-container txt-xsmall-plus text-ui-fg-subtle flex items-center justify-between w-full h-full text-small-regular">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
@keyframes bannerTicker {
|
@keyframes bannerTicker {
|
||||||
0% { transform: translateX(100%); }
|
0% {
|
||||||
100% { transform: translateX(-100%); }
|
transform: translateX(100%);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ticker {
|
.ticker {
|
||||||
|
|
@ -8,5 +12,6 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
animation: bannerTicker linear infinite;
|
animation: bannerTicker linear infinite;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
gap: 3rem
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,21 @@ import styles from "./banner-ticker.module.css"
|
||||||
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
||||||
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map"
|
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map"
|
||||||
|
|
||||||
export default function BannerTicker({ node, context }: { node: LayoutComponentDefinition; context: LayoutContext }) {
|
interface BannerTickerProps {
|
||||||
const props = node.config ?? {}
|
node: LayoutComponentDefinition
|
||||||
|
context: LayoutContext
|
||||||
|
}
|
||||||
|
interface BannerConfigProps {
|
||||||
|
items?: LayoutComponentDefinition[]
|
||||||
|
speed?: number
|
||||||
|
}
|
||||||
|
export default function BannerTicker({ node, context }: BannerTickerProps) {
|
||||||
|
const props = node.config as BannerConfigProps ?? {}
|
||||||
const speed = props.speed ?? 10;
|
const speed = props.speed ?? 10;
|
||||||
return (
|
return (
|
||||||
<div className="relative overflow-hidden w-full h-full">
|
<div className="relative overflow-hidden w-full h-full">
|
||||||
<div className={styles.ticker} style={{ animationDuration: `${speed}s` }} >
|
<div className={styles.ticker} style={{ animationDuration: `${speed}s` }} >
|
||||||
<DynamicLayoutRenderer nodes={props.items} context={context} />
|
<DynamicLayoutRenderer nodes={props.items ?? []} context={context} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,42 @@
|
||||||
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
import {
|
||||||
import { clx } from "@medusajs/ui";
|
LayoutComponentDefinition,
|
||||||
import BannerNav from "./banner-nav";
|
LayoutContext,
|
||||||
import BannerCTA from "./banner-cta";
|
} from "vibentec/component-map"
|
||||||
import BannerTicker from "./banner-ticker";
|
import { clx } from "@medusajs/ui"
|
||||||
|
import BannerNav from "./banner-nav"
|
||||||
|
import BannerCTA from "./banner-cta"
|
||||||
|
import BannerTicker from "./banner-ticker"
|
||||||
|
|
||||||
export default async function Banner({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) {
|
interface BannerProps {
|
||||||
const props = nodes.config ?? {};
|
variant: "nav" | "cta" | "ticker"
|
||||||
const bannerClassName = clx("relative h-8 mx-auto border-b duration-200 bg-white border-ui-border-base", props.className);
|
className?: string
|
||||||
const bannerVariant = props.variant as "nav" | "cta" | "ticker";
|
speed?: number
|
||||||
if (!bannerVariant) return null;
|
}
|
||||||
|
export default async function Banner({
|
||||||
|
nodes,
|
||||||
|
context,
|
||||||
|
}: {
|
||||||
|
nodes: LayoutComponentDefinition
|
||||||
|
context: LayoutContext
|
||||||
|
}) {
|
||||||
|
const props = (nodes.config as BannerProps) ?? {}
|
||||||
|
const bannerClassName = clx(
|
||||||
|
"relative h-8 mx-auto border-b duration-200 bg-white border-ui-border-base",
|
||||||
|
props.className
|
||||||
|
)
|
||||||
|
if (!props.variant) return null
|
||||||
|
|
||||||
const variants = {
|
const variants = {
|
||||||
"nav": BannerNav,
|
nav: BannerNav,
|
||||||
"cta": BannerCTA,
|
cta: BannerCTA,
|
||||||
"ticker": BannerTicker,
|
ticker: BannerTicker,
|
||||||
};
|
}
|
||||||
|
|
||||||
const Component = variants[bannerVariant];
|
const Component = variants[props.variant]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={bannerClassName}>
|
<div className={bannerClassName}>
|
||||||
<Component node={nodes} context={context}/>
|
<Component node={nodes} context={context} />
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { clx } from "@medusajs/ui"
|
||||||
|
import {
|
||||||
|
LayoutComponentDefinition,
|
||||||
|
LayoutContext,
|
||||||
|
} from "@vibentec/component-map"
|
||||||
|
import Image from "next/image"
|
||||||
|
|
||||||
|
export interface VtImageConfig {
|
||||||
|
src: string
|
||||||
|
alt: string
|
||||||
|
className?: string,
|
||||||
|
objectFit?: string,
|
||||||
|
}
|
||||||
|
export default function VtImage({
|
||||||
|
nodes,
|
||||||
|
context,
|
||||||
|
}: {
|
||||||
|
nodes: LayoutComponentDefinition
|
||||||
|
context: LayoutContext
|
||||||
|
}) {
|
||||||
|
const props = (nodes.config as VtImageConfig) ?? {}
|
||||||
|
return (
|
||||||
|
<div className={clx("relative", props.className)}>
|
||||||
|
<Image src={props.src} alt={props.alt} fill objectFit={props.objectFit ?? "contain"} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,17 @@
|
||||||
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
import { DynamicLayoutRenderer } from "vibentec/renderer"
|
||||||
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
|
||||||
|
|
||||||
|
interface BannerNavProps {
|
||||||
|
className?: string;
|
||||||
|
left?: LayoutComponentDefinition[];
|
||||||
|
center?: LayoutComponentDefinition[];
|
||||||
|
right?: LayoutComponentDefinition[];
|
||||||
|
}
|
||||||
export default function VtNav({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) {
|
export default function VtNav({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) {
|
||||||
const props = nodes.config ?? {}
|
const props = nodes.config as BannerNavProps ?? {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative h-16 mx-auto border-b duration-200 bg-white border-ui-border-base">
|
<div className="relative mx-auto border-b duration-200 bg-white border-ui-border-base">
|
||||||
<nav className="content-container txt-xsmall-plus text-ui-fg-subtle flex items-center justify-between w-full h-full text-small-regular">
|
<nav className="content-container txt-xsmall-plus text-ui-fg-subtle flex items-center justify-between w-full h-full text-small-regular">
|
||||||
<div className="flex items-center gap-x-4">
|
<div className="flex items-center gap-x-4">
|
||||||
{props.left && <DynamicLayoutRenderer nodes={props.left} context={context} />}
|
{props.left && <DynamicLayoutRenderer nodes={props.left} context={context} />}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import Banner from "@modules/layout/templates/vt-banner"
|
||||||
import VtMegaMenu from "@modules/layout/components/vt-mega-menu"
|
import VtMegaMenu from "@modules/layout/components/vt-mega-menu"
|
||||||
import VtLink from "@modules/layout/components/vt-linkbutton"
|
import VtLink from "@modules/layout/components/vt-linkbutton"
|
||||||
import VtSideMenu from "@modules/layout/components/vt-sidemenu"
|
import VtSideMenu from "@modules/layout/components/vt-sidemenu"
|
||||||
|
import VtImage from "@modules/layout/templates/vt-image"
|
||||||
|
|
||||||
type ComponentConfig = Record<string, any>;
|
type ComponentConfig = Record<string, any>;
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ export type ComponentRenderer = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility methods
|
// Utility methods
|
||||||
const configOnly = (Component: React.ComponentType<any>): ComponentRenderer => ({
|
const configOnly = (Component: React.ComponentType<any>): ComponentRenderer => ({
|
||||||
render: (entry) => <Component {...entry.config} />
|
render: (entry) => <Component {...entry.config} />
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -55,6 +56,7 @@ export const componentMap: Record<string, ComponentRenderer> = {
|
||||||
AccountButton: nodesContextRenderer(AccountButton),
|
AccountButton: nodesContextRenderer(AccountButton),
|
||||||
VtCartButton: nodesContextRenderer(VtCartButton),
|
VtCartButton: nodesContextRenderer(VtCartButton),
|
||||||
Link: nodesContextRenderer(VtLink),
|
Link: nodesContextRenderer(VtLink),
|
||||||
|
Image: nodesContextRenderer(VtImage),
|
||||||
CartMismatchBanner: configOnly(CartMismatchBanner),
|
CartMismatchBanner: configOnly(CartMismatchBanner),
|
||||||
FreeShippingPriceNudge: configOnly(FreeShippingPriceNudge),
|
FreeShippingPriceNudge: configOnly(FreeShippingPriceNudge),
|
||||||
PropsChildren: {
|
PropsChildren: {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import fs from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { jsonFileNames } from "./devJsonFileNames";
|
import { jsonFileNames } from "./devJsonFileNames";
|
||||||
|
|
||||||
const fileName = jsonFileNames.stePlayGround;
|
const fileName = jsonFileNames.nam3Bear;
|
||||||
|
|
||||||
export async function loadDesignConfig() {
|
export async function loadDesignConfig() {
|
||||||
const filePath = path.join(process.cwd(), "config", fileName)
|
const filePath = path.join(process.cwd(), "config", fileName)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
export const jsonFileNames = {
|
export const jsonFileNames = {
|
||||||
steMedusaStarter: "ste.medusa-starter.design.json",
|
steMedusaStarter: "ste.medusa-starter.design.json",
|
||||||
stePlayGround: "ste.playground.design.json"
|
stePlayGround: "ste.playground.design.json",
|
||||||
|
nam3Bear: "nam.3bear.design.json",
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue