Skip to content

Commit 4316b13

Browse files
authored
Merge pull request #224 from code0-tech/feat/rework-sections
Feat/rework sections
2 parents 7adbc73 + ed4d057 commit 4316b13

46 files changed

Lines changed: 2670 additions & 1467 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { CtaSection } from "@/components/sections/CtaSection"
2-
import { EditionFeatureSection } from "@/components/sections/EditionFeatureSection"
3-
import { EditionHeroSection } from "@/components/sections/EditionHeroSection"
4-
import { EditionInstallSection } from "@/components/sections/EditionInstallSection"
5-
import { EditionUseCaseSection } from "@/components/sections/EditionUseCaseSection"
1+
import { PageBlocks } from "@/components/PageBlockRenderer"
62
import { LandingContainer } from "@/components/ui/LandingContainer"
73
import { getLandingPage } from "@/lib/cms"
84
import { isSupportedLocale } from "@/lib/i18n"
@@ -20,31 +16,11 @@ export default async function CommunityEditionPage({ params }: { params: Promise
2016
if (!isSupportedLocale(locale)) notFound()
2117

2218
const page = await getLandingPage("community-edition", locale)
23-
const heroBlock = page?.layout?.find((item) => item.blockType === "editionHero") ?? null
24-
const featuresBlock = page?.layout?.find((item) => item.blockType === "editionFeatures") ?? null
25-
const installBlock = page?.layout?.find((item) => item.blockType === "editionInstall") ?? null
26-
const useCaseBlock = page?.layout?.find((item) => item.blockType === "editionUseCases") ?? null
27-
const ctaBlock = page?.layout?.find((item) => item.blockType === "cta") ?? null
2819

2920
return (
3021
<LandingContainer>
3122
<div className="h-12 lg:h-16" aria-hidden="true" />
32-
<EditionHeroSection
33-
content={heroBlock}
34-
locale={locale}
35-
grainientColors={{
36-
color1: "#10213a",
37-
color2: "#f872e2",
38-
color3: "#f8f172",
39-
backgroundColor: "#0b1324",
40-
}}
41-
/>
42-
<div className="h-32" aria-hidden="true" />
43-
<EditionFeatureSection content={featuresBlock} />
44-
<div className="h-32" aria-hidden="true" />
45-
<EditionInstallSection content={installBlock} />
46-
<div className="h-32" aria-hidden="true" />
47-
<CtaSection content={ctaBlock} />
23+
<PageBlocks blocks={page?.layout} locale={locale} />
4824
</LandingContainer>
4925
)
5026
}
Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import { CtaSection } from "@/components/sections/CtaSection"
2-
import { EditionFeatureSection } from "@/components/sections/EditionFeatureSection"
3-
import { EditionHeroSection } from "@/components/sections/EditionHeroSection"
4-
import { EditionUseCaseSection } from "@/components/sections/EditionUseCaseSection"
1+
import { PageBlocks } from "@/components/PageBlockRenderer"
52
import { LandingContainer } from "@/components/ui/LandingContainer"
63
import { getLandingPage } from "@/lib/cms"
7-
import type { CtaLayoutBlock } from "@/lib/cms"
84
import { isSupportedLocale } from "@/lib/i18n"
95
import { getLandingPageMetadata } from "@/lib/pageMetadata"
106
import type { Metadata } from "next"
117
import { notFound } from "next/navigation"
12-
import React from "react"
138

149
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
1510
const { locale } = await params
@@ -21,35 +16,11 @@ export default async function EnterpriseEditionPage({ params }: { params: Promis
2116
if (!isSupportedLocale(locale)) notFound()
2217

2318
const page = await getLandingPage("enterprise-edition", locale)
24-
const heroBlock = page?.layout?.find((item) => item.blockType === "editionHero") ?? null
25-
const ctaBlock = (page?.layout?.find((item) => item.blockType === "cta") ?? null) as CtaLayoutBlock | null
26-
const blocks = page?.layout?.filter((item) => item.blockType === "editionUseCases" || item.blockType === "editionFeatures") ?? []
2719

2820
return (
2921
<LandingContainer>
3022
<div className="h-12 lg:h-16" aria-hidden="true" />
31-
<EditionHeroSection
32-
content={heroBlock}
33-
locale={locale}
34-
grainientColors={{
35-
color1: "#13102d",
36-
color2: "#7472f8",
37-
color3: "#72c9f8",
38-
backgroundColor: "#140c22",
39-
}}
40-
/>
41-
{blocks.map((block, index) => (
42-
<React.Fragment key={index}>
43-
<div className="h-32" aria-hidden="true" />
44-
{block.blockType === "editionFeatures" ? (
45-
<EditionFeatureSection content={block} />
46-
) : block.blockType === "editionUseCases" ? (
47-
<EditionUseCaseSection content={block} />
48-
) : null}
49-
</React.Fragment>
50-
))}
51-
<div className="h-32" aria-hidden="true" />
52-
<CtaSection content={ctaBlock} floatingCta locale={locale} />
23+
<PageBlocks blocks={page?.layout} ctaFloating locale={locale} />
5324
</LandingContainer>
5425
)
5526
}

src/app/(landing)/[locale]/layout.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ConsentManager from "@/components/providers/ConsentManager"
22
import { Navigation } from "@/components/navigation/Navigation"
3-
import { SectionsProvider } from "@/components/providers/SectionsProvider"
43
import { FooterSection } from "@/components/sections/FooterSection"
54
import { getFooter } from "@/lib/cms"
65
import { getNavbarItems } from "@/lib/cms"
@@ -23,21 +22,18 @@ export default async function LocaleLayout({ children, params }: LocaleLayoutPro
2322
notFound()
2423
}
2524

26-
const [items, footer, sections] = await Promise.all([
25+
const [items, footer] = await Promise.all([
2726
getNavbarItems(locale),
2827
getFooter(locale),
29-
getSections(locale),
3028
])
3129

3230
return (
3331
<ConsentManager locale={locale}>
3432
<div className="relative bg-primary overflow-x-hidden">
3533
<Navigation locale={locale} items={items} footer={footer} />
36-
<SectionsProvider sections={sections}>
37-
<main id="main-content" className="bg-primary">
38-
{children}
39-
</main>
40-
</SectionsProvider>
34+
<main id="main-content" className="bg-primary">
35+
{children}
36+
</main>
4137
<FooterSection locale={locale} footer={footer} />
4238
<div className="pointer-events-none absolute inset-x-0 bottom-0 z-50 flex justify-center" aria-hidden="true">
4339
<div className="h-16 w-full bg-blue/20 blur-3xl" />
Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1+
import { DeploymentImage } from "@/components/DeploymentImage"
2+
import { PageBlocks } from "@/components/PageBlockRenderer"
13
import { LandingContainer } from "@/components/ui/LandingContainer"
2-
import { HeroSection } from "@/components/sections/HeroSection"
3-
import { BrandSection } from "@/components/sections/BrandSection"
4-
import { UseCaseSection } from "@/components/sections/UseCaseSection"
5-
import { AppFeatureSection } from "@/components/sections/AppFeatureSection"
6-
import { DeploymentSection } from "@/components/sections/DeploymentSection"
7-
import { RuntimeFeatureSection } from "@/components/sections/RuntimeFeatureSection"
8-
import { RoadmapSection } from "@/components/sections/RoadmapSection"
9-
import { FaqSection } from "@/components/sections/FaqSection"
10-
import { CtaSection } from "@/components/sections/CtaSection"
114
import { getLandingPage } from "@/lib/cms"
125
import type { DeploymentLayoutBlock, HeroLayoutBlock } from "@/lib/cms"
136
import type { BrandLayoutBlock } from "@/lib/cms"
@@ -26,38 +19,22 @@ export async function generateMetadata({ params }: { params: Promise<{ locale: s
2619

2720
export default async function Page({ params }: { params: Promise<{ locale: string }> }) {
2821
const { locale } = await params
29-
if (!isSupportedLocale(locale)) {
30-
notFound()
31-
}
22+
if (!isSupportedLocale(locale)) notFound()
3223

3324
const page = await getLandingPage("main", locale)
34-
const layout = page?.layout ?? []
35-
const heroBlock = layout.find((block): block is HeroLayoutBlock => block.blockType === "hero") ?? null
36-
const brandBlock = layout.find((block): block is BrandLayoutBlock => block.blockType === "brand") ?? null
37-
const useCaseBlock = layout.find((block): block is UseCaseLayoutBlock => block.blockType === "usecase") ?? null
38-
const faqBlock = layout.find((block): block is FaqLayoutBlock => block.blockType === "faq") ?? null
39-
const ctaBlock = layout.find((block): block is CtaLayoutBlock => block.blockType === "cta") ?? null
40-
const deploymentBlock = layout.find((block): block is DeploymentLayoutBlock => block.blockType === "deployment") ?? null
4125

4226
return (
4327
<LandingContainer>
4428
<div className="h-12 lg:h-16" aria-hidden="true" />
45-
<HeroSection content={heroBlock} />
46-
<BrandSection content={brandBlock} />
47-
<div className="h-32" aria-hidden="true" />
48-
<UseCaseSection content={useCaseBlock} />
49-
<div className="h-32" aria-hidden="true" />
50-
<AppFeatureSection locale={locale} />
51-
<div className="h-32" aria-hidden="true" />
52-
<DeploymentSection content={deploymentBlock} />
53-
<div className="h-32" aria-hidden="true" />
54-
<RuntimeFeatureSection locale={locale} />
55-
<div className="h-32" aria-hidden="true" />
56-
<RoadmapSection locale={locale} />
57-
<div className="h-32" aria-hidden="true" />
58-
<FaqSection content={faqBlock} />
59-
<div className="h-32" aria-hidden="true" />
60-
<CtaSection content={ctaBlock} />
29+
<PageBlocks
30+
blocks={page?.layout}
31+
locale={locale}
32+
cardRowChildren={[
33+
<DeploymentImage key="cloud" color="aqua" icon="cloud" text="Cloud" />,
34+
<DeploymentImage key="selfhost" color="pink" icon="server" text="Selfhost" />,
35+
<DeploymentImage key="dynamic" color="brand" icon="cloud-computing" text="Dynamic" />,
36+
]}
37+
/>
6138
</LandingContainer>
6239
)
6340
}

src/blocks/BentoBlock.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import type { Block } from "payload"
2+
3+
export const BentoBlock: Block = {
4+
slug: "bento",
5+
labels: {
6+
singular: "Bento",
7+
plural: "Bento Blocks",
8+
},
9+
fields: [
10+
{
11+
type: "collapsible",
12+
label: "Section",
13+
fields: [
14+
{
15+
name: "sectionHeading",
16+
label: "Section Heading",
17+
type: "text",
18+
required: false,
19+
localized: true,
20+
},
21+
{
22+
name: "sectionDescription",
23+
label: "Section Description",
24+
type: "textarea",
25+
required: false,
26+
localized: true,
27+
},
28+
{
29+
name: "sectionLinkButton",
30+
label: "Section Link Button",
31+
type: "group",
32+
fields: [
33+
{
34+
name: "label",
35+
type: "text",
36+
required: false,
37+
localized: true,
38+
},
39+
{
40+
name: "url",
41+
type: "text",
42+
required: false,
43+
},
44+
],
45+
},
46+
],
47+
},
48+
{
49+
name: "variant",
50+
label: "Variant",
51+
type: "select",
52+
required: true,
53+
defaultValue: "feature",
54+
options: [
55+
{
56+
label: "Feature",
57+
value: "feature",
58+
},
59+
{
60+
label: "Runtime",
61+
value: "runtime",
62+
},
63+
],
64+
},
65+
],
66+
}

src/blocks/CardRowBlock.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import type { Block } from "payload"
2+
3+
export const CardRowBlock: Block = {
4+
slug: "cardRow",
5+
labels: {
6+
singular: "Card Row",
7+
plural: "Card Rows",
8+
},
9+
fields: [
10+
{
11+
type: "collapsible",
12+
label: "Section",
13+
fields: [
14+
{
15+
name: "sectionHeading",
16+
label: "Section Heading",
17+
type: "text",
18+
required: false,
19+
localized: true,
20+
},
21+
{
22+
name: "sectionDescription",
23+
label: "Section Description",
24+
type: "textarea",
25+
required: false,
26+
localized: true,
27+
},
28+
{
29+
name: "sectionLinkButton",
30+
label: "Section Link Button",
31+
type: "group",
32+
fields: [
33+
{
34+
name: "label",
35+
type: "text",
36+
required: false,
37+
localized: true,
38+
},
39+
{
40+
name: "url",
41+
type: "text",
42+
required: false,
43+
},
44+
],
45+
},
46+
],
47+
},
48+
{
49+
name: "cards",
50+
label: "Cards",
51+
type: "array",
52+
required: false,
53+
fields: [
54+
{
55+
name: "title",
56+
type: "text",
57+
required: true,
58+
localized: true,
59+
},
60+
{
61+
name: "description",
62+
type: "textarea",
63+
required: false,
64+
localized: true,
65+
},
66+
{
67+
name: "link",
68+
type: "group",
69+
fields: [
70+
{
71+
name: "label",
72+
type: "text",
73+
required: false,
74+
localized: true,
75+
},
76+
{
77+
name: "url",
78+
type: "text",
79+
required: false,
80+
},
81+
],
82+
},
83+
{
84+
name: "image",
85+
type: "upload",
86+
relationTo: "media",
87+
required: false,
88+
},
89+
],
90+
},
91+
],
92+
}

0 commit comments

Comments
 (0)