refactor: combine 3bear cta section into dynamic cta section

This commit is contained in:
Nam Doan 2025-12-19 10:10:57 +07:00
parent 7afffb3f99
commit a2e5b56eb8
7 changed files with 50 additions and 69 deletions

View File

@ -192,8 +192,9 @@
{ {
"VtCtaBanner": { "VtCtaBanner": {
"config": { "config": {
"variant": "3bear", "className": "left-[120px] top-[80px] relative w-full p-12 flex flex-col items-start justify-center text-left bg-transperant border-none shadow-none",
"className": "left-[120px] top-[80px]", "buttonTextClassName": "inline-flex items-center justify-center bg-[#FCEE56] hover:bg-[#FCEE56]/90 text-[#0D382E] px-8 py-3 rounded-full font-bold text-lg shadow-none border-none",
"tagTextClassName": "text-[#0D382E] text-lg font-medium mb-2 bg-transparent",
"tagText": "So einfach kann Frühstück sein mit unseren leckeren Overnight Oats.", "tagText": "So einfach kann Frühstück sein mit unseren leckeren Overnight Oats.",
"titleText": "breakfast made easy.", "titleText": "breakfast made easy.",
"buttonText": "Jetzt entdecken" "buttonText": "Jetzt entdecken"

View File

@ -182,7 +182,7 @@
"className": "h-[35rem]", "className": "h-[35rem]",
"ImageDisplayer": { "ImageDisplayer": {
"config": { "config": {
"duration": 0, "duration": 5,
"images": [ "images": [
"./banner-hero.webp", "./banner-hero.webp",
"./banner-hero-1.webp", "./banner-hero-1.webp",

View File

@ -23,11 +23,14 @@ export default async function Home(props: {
const { collections } = await listCollections({ const { collections } = await listCollections({
fields: "id, handle, title", fields: "id, handle, title",
}) })
const res = await listCollections({
fields: "id, handle, title",
})
if (!collections || !region) { if (!collections || !region) {
return null return null
} }
console.log(res, '--------------')
return ( return (
<> <>
{/* <Hero /> */} {/* <Hero /> */}

View File

@ -23,7 +23,6 @@ export default function VtCountrySelectClient({
const triggerText = props?.trigger?.text const triggerText = props?.trigger?.text
const [items, setItems] = useState<{ text: string; label?: string }[]>([]) const [items, setItems] = useState<{ text: string; label?: string }[]>([])
const { countryCode } = useParams() const { countryCode } = useParams()
console.log(regions)
useEffect(() => { useEffect(() => {
if (!regions || regions.length === 0) { if (!regions || regions.length === 0) {
setItems([]) setItems([])
@ -39,7 +38,6 @@ export default function VtCountrySelectClient({
.flat() .flat()
.filter((o) => o.text) .filter((o) => o.text)
.sort((a, b) => (a.label ?? "").localeCompare(b.label ?? "")) .sort((a, b) => (a.label ?? "").localeCompare(b.label ?? ""))
console.log(opts)
setItems(opts) setItems(opts)
}, [regions]) }, [regions])

View File

@ -1,35 +0,0 @@
"use client"
import { Button, clx } from "@medusajs/ui"
import {
LayoutComponentDefinition,
LayoutContext,
} from "@vibentec/component-map"
export function BearCtaBanner({
nodes,
context,
}: {
nodes: LayoutComponentDefinition
context: LayoutContext
}) {
const props = nodes.config ?? {}
return (
<div className={clx(
"relative w-full p-12 flex flex-col items-start justify-center text-left",
props.className
)}>
<p className="text-[#0D382E] text-lg font-medium mb-2">
{props.tagText ?? "So einfach kann Frühstück sein mit unseren leckeren Overnight Oats."}
</p>
<h1 className="text-[#0D382E] font-black leading-tight text-[64px] mb-8 tracking-tight">
{props.titleText ?? "breakfast made easy."}
</h1>
<Button className="inline-flex items-center justify-center bg-[#FCEE56] hover:bg-[#FCEE56]/90 text-[#0D382E] px-8 py-3 rounded-full font-bold text-lg shadow-none border-none">
{props.buttonText ?? "Jetzt entdecken"}
</Button>
</div>
)
}

View File

@ -15,35 +15,51 @@ export function DefaultCtaBanner({
}) { }) {
const props = nodes.config ?? {} const props = nodes.config ?? {}
return ( return (
<div className={clx( <div
"relative w-[544px] bg-white rounded-[24px] border border-[#E6EFFC] shadow-[0_12px_40px_rgba(17,49,78,0.10)] p-6", className={clx(
props.className "relative w-[544px] bg-white rounded-[24px] border border-[#E6EFFC] shadow-[0_12px_40px_rgba(17,49,78,0.10)] p-6",
)}> props.className
<div className={clx( )}
"inline-flex items-center rounded-full bg-[#FCE9DA] text-[#E68445] px-3 py-1 text-sm font-medium", >
props.tagTextClassName {props.tagText && (
)}> <div
{props.tagText} className={clx(
</div> "inline-flex items-center rounded-full bg-[#FCE9DA] text-[#E68445] px-3 py-1 text-sm font-medium",
props.tagTextClassName
)}
>
{props.tagText}
</div>
)}
<h1 className={clx( {props.titleText && (
"mt-4 text-[#11314E] font-semibold leading-normal text-[56px]", <h1
props.titleTextClassName className={clx(
)}> "mt-4 text-[#11314E] font-semibold leading-normal text-[56px]",
{props.titleText} props.titleTextClassName
</h1> )}
>
{props.titleText}
</h1>
)}
<p className={clx( {props.descriptionText && (
"mt-5 text-[#285A86] text-[16px] sm:text-xl opacity-80", <p
props.descriptionTextClassName className={clx(
)}> "mt-5 text-[#285A86] text-[16px] sm:text-xl opacity-80",
{props.descriptionText} props.descriptionTextClassName
</p> )}
>
{props.descriptionText}
</p>
)}
<Button className={clx( <Button
"mt-8 inline-flex items-center gap-2 bg-[#0F2740] hover:bg-[#173551] text-white px-6 py-3 rounded-[12px] shadow-md", className={clx(
props.buttonTextClassName "mt-8 inline-flex items-center gap-2 bg-[#0F2740] hover:bg-[#173551] text-white px-6 py-3 rounded-[12px] shadow-md",
)}> props.buttonTextClassName
)}
>
{props.buttonText} {props.buttonText}
<ChevronRightMini /> <ChevronRightMini />
</Button> </Button>

View File

@ -4,7 +4,6 @@ import {
LayoutContext, LayoutContext,
} from "@vibentec/component-map" } from "@vibentec/component-map"
import { DefaultCtaBanner } from "./default-cta" import { DefaultCtaBanner } from "./default-cta"
import { BearCtaBanner } from "./bear-cta"
export function VtCtaBanner({ export function VtCtaBanner({
nodes, nodes,
@ -18,7 +17,6 @@ export function VtCtaBanner({
const variants: Record<string, any> = { const variants: Record<string, any> = {
default: DefaultCtaBanner, default: DefaultCtaBanner,
"3bear": BearCtaBanner,
} }
const Component = variants[variant] || DefaultCtaBanner const Component = variants[variant] || DefaultCtaBanner