diff --git a/apps/sanity/src/app/layout.tsx b/apps/sanity/src/app/layout.tsx index 7ef13ff..09dcea1 100644 --- a/apps/sanity/src/app/layout.tsx +++ b/apps/sanity/src/app/layout.tsx @@ -31,7 +31,7 @@ export default async function RootLayout({ lang="en" // className={`${mono.variable} ${sans.variable} ${serif.variable}`} > - {children} + {children} ); } diff --git a/apps/sanity/src/components/Footer/schema.tsx b/apps/sanity/src/components/Footer/schema.tsx index 23fa8c2..2e1d4ac 100644 --- a/apps/sanity/src/components/Footer/schema.tsx +++ b/apps/sanity/src/components/Footer/schema.tsx @@ -1,7 +1,6 @@ import { CommonGroup, commonGroups, - themeField, } from "@/contentSections/commonFields"; import { defineField } from "sanity"; @@ -44,7 +43,6 @@ export default { type: "string", group: CommonGroup.Content, }), - themeField, ], preview: { select: { diff --git a/apps/sanity/src/components/Header/schema.tsx b/apps/sanity/src/components/Header/schema.tsx index 4ceb183..d1810c2 100644 --- a/apps/sanity/src/components/Header/schema.tsx +++ b/apps/sanity/src/components/Header/schema.tsx @@ -1,8 +1,4 @@ -import { - CommonGroup, - commonGroups, - themeField, -} from "@/contentSections/commonFields"; +import { CommonGroup, commonGroups } from "@/contentSections/commonFields"; import { AlignVariant } from "@shared/ui/components/sections/header/types"; import { defineField } from "sanity"; @@ -49,7 +45,6 @@ export default { validation: (Rule) => Rule.required(), initialValue: AlignVariant.Right, }), - themeField, ], preview: { select: { diff --git a/apps/sanity/src/components/Page/index.tsx b/apps/sanity/src/components/Page/index.tsx index e157362..0594ee3 100644 --- a/apps/sanity/src/components/Page/index.tsx +++ b/apps/sanity/src/components/Page/index.tsx @@ -1,6 +1,6 @@ import { SectionRenderer } from "@/contentSections"; -import { CookieBanner } from "@shared/ui"; +import { cn, CookieBanner } from "@shared/ui"; import Footer from "../Footer"; import Header from "../Header"; @@ -9,10 +9,10 @@ import type { IPageProps } from "./types"; export default function Page({ data }: IPageProps) { if (!data) return null; - const { sectionsBody, showCookieBanner, header, footer } = data; + const { sectionsBody, showCookieBanner, header, footer, theme } = data; return ( -
+
{sectionsBody?.map((section) => ( diff --git a/apps/sanity/src/components/Page/schema.ts b/apps/sanity/src/components/Page/schema.ts index 4b9a2dd..79485b7 100644 --- a/apps/sanity/src/components/Page/schema.ts +++ b/apps/sanity/src/components/Page/schema.ts @@ -1,7 +1,11 @@ -import { CommonGroup } from "@/contentSections/commonFields"; +import { + CommonGroup, + commonGroups, + themeField, +} from "@/contentSections/commonFields"; // import { sectionsPresets } from "@/contentSections/presets"; import { definePathname } from "@tinloof/sanity-studio"; -import { defineField, defineType } from "sanity"; +import { defineField, defineType, type FieldGroupDefinition } from "sanity"; import sections from "@/lib/schemas/sections"; @@ -11,14 +15,12 @@ export default defineType({ type: "document", name: "page", groups: [ - { - name: "content", - title: "Content", - default: true, - }, + commonGroups[0] as FieldGroupDefinition, { name: "seo", title: "SEO" }, + commonGroups[1] as FieldGroupDefinition, ], fields: [ + themeField, defineField({ type: "string", name: "title", diff --git a/apps/sanity/src/components/SectionContainer/index.tsx b/apps/sanity/src/components/SectionContainer/index.tsx index cff29af..926f6f2 100644 --- a/apps/sanity/src/components/SectionContainer/index.tsx +++ b/apps/sanity/src/components/SectionContainer/index.tsx @@ -9,15 +9,8 @@ export default function SectionContainer({ className, sectionData, }: ISectionContainerProps) { - const { - _key, - theme, - marginTop, - marginBottom, - paddingX, - paddingY, - noMaxWidth, - } = sectionData; + const { _key, marginTop, marginBottom, paddingX, paddingY, noMaxWidth } = + sectionData; const cleanMarginTop = stegaClean(marginTop); const cleanMarginBottom = stegaClean(marginBottom); @@ -25,7 +18,7 @@ export default function SectionContainer({ return (
Rule.required(), }), - themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/CardsGrid/schema.ts b/apps/sanity/src/contentSections/CardsGrid/schema.ts index f6608ed..0fa8f55 100644 --- a/apps/sanity/src/contentSections/CardsGrid/schema.ts +++ b/apps/sanity/src/contentSections/CardsGrid/schema.ts @@ -6,7 +6,6 @@ import { CommonGroup, commonGroups, sectionMarginFields, - themeField, } from "../commonFields"; const featurePointStyles = [ @@ -109,7 +108,6 @@ export default { of: [{ type: "defaultCard" }], validation: (Rule) => Rule.required().min(1), }), - themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/Copy/schema.ts b/apps/sanity/src/contentSections/Copy/schema.ts index 110d527..3a36298 100644 --- a/apps/sanity/src/contentSections/Copy/schema.ts +++ b/apps/sanity/src/contentSections/Copy/schema.ts @@ -6,7 +6,6 @@ import { CommonGroup, commonGroups, sectionMarginFields, - themeField, } from "../commonFields"; export default { @@ -31,7 +30,6 @@ export default { initialValue: false, validation: (Rule) => Rule.required(), }), - themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/Hero/schema.ts b/apps/sanity/src/contentSections/Hero/schema.ts index 55e5e5d..2fc189d 100644 --- a/apps/sanity/src/contentSections/Hero/schema.ts +++ b/apps/sanity/src/contentSections/Hero/schema.ts @@ -39,7 +39,6 @@ export default { of: [{ type: customLink.name }], validation: (Rule) => Rule.required(), }), - // themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/LinksList/schema.ts b/apps/sanity/src/contentSections/LinksList/schema.ts index 29bf050..7fe2c17 100644 --- a/apps/sanity/src/contentSections/LinksList/schema.ts +++ b/apps/sanity/src/contentSections/LinksList/schema.ts @@ -7,7 +7,6 @@ import { CommonGroup, commonGroups, sectionMarginFields, - themeField, } from "../commonFields"; export default { @@ -39,7 +38,6 @@ export default { validation: (Rule) => Rule.required(), initialValue: AlignVariant.Left, }), - themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/Logos/schema.ts b/apps/sanity/src/contentSections/Logos/schema.ts index 8908c0d..61edf00 100644 --- a/apps/sanity/src/contentSections/Logos/schema.ts +++ b/apps/sanity/src/contentSections/Logos/schema.ts @@ -8,7 +8,6 @@ import { CommonGroup, commonGroups, sectionMarginFields, - themeField, } from "../commonFields"; export const logoItem = defineType({ @@ -79,7 +78,6 @@ export default { validation: (Rule) => Rule.required(), initialValue: AlignVariant.Left, }), - themeField, ...sectionMarginFields, ], preview: { diff --git a/apps/sanity/src/contentSections/commonFields.tsx b/apps/sanity/src/contentSections/commonFields.tsx index da76ad5..5352192 100644 --- a/apps/sanity/src/contentSections/commonFields.tsx +++ b/apps/sanity/src/contentSections/commonFields.tsx @@ -1,11 +1,11 @@ -import { defineField } from "sanity"; +import { defineField, type FieldGroupDefinition } from "sanity"; export enum CommonGroup { Content = "content", Style = "style", } -export const commonGroups = [ +export const commonGroups: FieldGroupDefinition[] = [ { name: CommonGroup.Content, title: "Content", diff --git a/apps/sanity/src/generated/extracted-schema.json b/apps/sanity/src/generated/extracted-schema.json index 4db0070..14c7c6e 100644 --- a/apps/sanity/src/generated/extracted-schema.json +++ b/apps/sanity/src/generated/extracted-schema.json @@ -1014,23 +1014,6 @@ }, "optional": false }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false - }, "marginTop": { "type": "objectAttribute", "value": { @@ -1132,23 +1115,6 @@ }, "optional": false }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false - }, "marginTop": { "type": "objectAttribute", "value": { @@ -1250,23 +1216,6 @@ }, "optional": false }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false - }, "marginTop": { "type": "objectAttribute", "value": { @@ -1368,23 +1317,6 @@ }, "optional": false }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false - }, "marginTop": { "type": "objectAttribute", "value": { @@ -1472,23 +1404,6 @@ }, "optional": false }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false - }, "marginTop": { "type": "objectAttribute", "value": { @@ -2328,6 +2243,23 @@ "type": "string" } }, + "theme": { + "type": "objectAttribute", + "value": { + "type": "union", + "of": [ + { + "type": "string", + "value": "light" + }, + { + "type": "string", + "value": "dark" + } + ] + }, + "optional": false + }, "title": { "type": "objectAttribute", "value": { @@ -2775,23 +2707,6 @@ "type": "string" }, "optional": true - }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false } } }, @@ -3195,23 +3110,6 @@ ] }, "optional": false - }, - "theme": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "light" - }, - { - "type": "string", - "value": "dark" - } - ] - }, - "optional": false } } }, diff --git a/apps/sanity/src/generated/extracted-types.ts b/apps/sanity/src/generated/extracted-types.ts index 091421e..460b24e 100644 --- a/apps/sanity/src/generated/extracted-types.ts +++ b/apps/sanity/src/generated/extracted-types.ts @@ -160,7 +160,6 @@ export type SectionBlog = { _key: string; } & BlogSectionPost >; - theme: "light" | "dark"; marginTop: "none" | "base" | "lg"; marginBottom: "none" | "base" | "lg"; }; @@ -173,7 +172,6 @@ export type SectionCardsGrid = { _key: string; } & DefaultCard >; - theme: "light" | "dark"; marginTop: "none" | "base" | "lg"; marginBottom: "none" | "base" | "lg"; }; @@ -186,7 +184,6 @@ export type SectionLinksList = { } & CustomLink >; alignVariant: "left" | "center" | "right"; - theme: "light" | "dark"; marginTop: "none" | "base" | "lg"; marginBottom: "none" | "base" | "lg"; }; @@ -199,7 +196,6 @@ export type SectionLogos = { } & LogoItem >; alignVariant: "left" | "center" | "right"; - theme: "light" | "dark"; marginTop: "none" | "base" | "lg"; marginBottom: "none" | "base" | "lg"; }; @@ -212,7 +208,6 @@ export type SectionCopy = { } & CustomRichText >; isReversedOnMobile: boolean; - theme: "light" | "dark"; marginTop: "none" | "base" | "lg"; marginBottom: "none" | "base" | "lg"; }; @@ -350,6 +345,7 @@ export type Page = { _createdAt: string; _updatedAt: string; _rev: string; + theme: "light" | "dark"; title?: string; pathname?: Slug; header: { @@ -432,7 +428,6 @@ export type Footer = { } & CustomLink >; copywriteText?: string; - theme: "light" | "dark"; }; export type CustomRichText = { @@ -501,7 +496,6 @@ export type Header = { } & CustomLink >; alignVariant: "left" | "center" | "right"; - theme: "light" | "dark"; }; export type SanityImageCrop = { @@ -688,7 +682,6 @@ export type PAGE_BY_SLUG_QUERYResult = { | "secondary"; }>; alignVariant: "center" | "left" | "right"; - theme: "dark" | "light"; }; sectionsBody: Array< | { @@ -725,7 +718,6 @@ export type PAGE_BY_SLUG_QUERYResult = { image?: CustomImage; text?: CustomRichText; }>; - theme: "dark" | "light"; marginTop: "base" | "lg" | "none"; marginBottom: "base" | "lg" | "none"; } @@ -766,7 +758,6 @@ export type PAGE_BY_SLUG_QUERYResult = { } | null; image?: CustomImage; }>; - theme: "dark" | "light"; marginTop: "base" | "lg" | "none"; marginBottom: "base" | "lg" | "none"; } @@ -779,7 +770,6 @@ export type PAGE_BY_SLUG_QUERYResult = { } & CustomRichText >; isReversedOnMobile: boolean; - theme: "dark" | "light"; marginTop: "base" | "lg" | "none"; marginBottom: "base" | "lg" | "none"; } @@ -836,7 +826,6 @@ export type PAGE_BY_SLUG_QUERYResult = { | "secondary"; }>; alignVariant: "center" | "left" | "right"; - theme: "dark" | "light"; marginTop: "base" | "lg" | "none"; marginBottom: "base" | "lg" | "none"; } @@ -869,7 +858,6 @@ export type PAGE_BY_SLUG_QUERYResult = { } | null; }>; alignVariant: "center" | "left" | "right"; - theme: "dark" | "light"; marginTop: "base" | "lg" | "none"; marginBottom: "base" | "lg" | "none"; } @@ -970,7 +958,6 @@ export type PAGE_BY_SLUG_QUERYResult = { | "secondary"; }> | null; copywriteText?: string; - theme: "dark" | "light"; }; title: string | null; slug: string | null; diff --git a/apps/sanity/src/lib/api/queries.ts b/apps/sanity/src/lib/api/queries.ts index 010c701..a1dd336 100644 --- a/apps/sanity/src/lib/api/queries.ts +++ b/apps/sanity/src/lib/api/queries.ts @@ -32,5 +32,6 @@ export const PAGE_BY_SLUG_QUERY = groq` seoDescription, ogImage, robots, + theme, } `; diff --git a/apps/storyblok/src/app/api/revalidate/route.ts b/apps/storyblok/src/app/api/revalidate/route.ts index e1d8f5f..f302f71 100644 --- a/apps/storyblok/src/app/api/revalidate/route.ts +++ b/apps/storyblok/src/app/api/revalidate/route.ts @@ -22,8 +22,6 @@ export async function POST(request: Request) { const generatedSignature = generateSignature(JSON.stringify(body)); - console.log("signature/gen sign: ", signature, generatedSignature); - if (signature !== generatedSignature) { return Response.json({ error: "Invalid signature" }, { status: 400 }); } diff --git a/apps/storyblok/src/components/Page/index.tsx b/apps/storyblok/src/components/Page/index.tsx index 4b0a423..5edbd18 100644 --- a/apps/storyblok/src/components/Page/index.tsx +++ b/apps/storyblok/src/components/Page/index.tsx @@ -1,16 +1,16 @@ import { StoryblokComponent, StoryblokStory } from "@storyblok/react/rsc"; -import { CookieBanner } from "@shared/ui"; +import { cn, CookieBanner } from "@shared/ui"; import type { IPageContainerProps } from "./types"; export default function PageContainer({ blok }: IPageContainerProps) { - const { sections, showCookieBanner } = blok; + const { sections, showCookieBanner, theme } = blok; if (!sections) return null; return ( -
+
{sections.map((s) => ( diff --git a/apps/storyblok/src/components/SectionContainer/index.tsx b/apps/storyblok/src/components/SectionContainer/index.tsx index ca42759..76739f0 100644 --- a/apps/storyblok/src/components/SectionContainer/index.tsx +++ b/apps/storyblok/src/components/SectionContainer/index.tsx @@ -18,7 +18,7 @@ export default function SectionContainer({ return (
| string; + theme: "light" | "dark"; component: "page"; _uid: string; [k: string]: any; diff --git a/apps/storyblok/src/generated/presets.production.json b/apps/storyblok/src/generated/presets.production.json index 12bdc2a..b65ee22 100644 --- a/apps/storyblok/src/generated/presets.production.json +++ b/apps/storyblok/src/generated/presets.production.json @@ -2832,9 +2832,10 @@ "name": "Home", "preset": { "_uid": "2b02874e-43a7-463b-a76f-cb457945ab65", + "theme": "light", "footer": "9242f0ad-4f23-46b4-a369-227f91b0d3fd", "header": "32a6be02-b148-40db-8f9b-bf4bd86572b1", - "robots": "index", + "robots": "no-index", "ogImage": { "id": 17302361, "alt": "", @@ -2917,11 +2918,11 @@ { "_uid": "3786705a-e3a5-4aea-8f36-15b5ada939a3", "link": { - "id": "5d416347-de08-4adb-b496-00b0a083de3a", + "id": "86c7697c-880f-46a3-948d-6c60d8076410", "url": "", "linktype": "story", "fieldtype": "multilink", - "cached_url": "blog" + "cached_url": "5443434343434-changing-slug-page" }, "text": "Get for free", "variant": "primary", @@ -2941,11 +2942,489 @@ "component": "link" } ], - "title": "Write. Plan. Collaborate.", + "title": "Write. Plan. Collaborate. Updated", "component": "hero", "marginTop": "lg", "marginBottom": "lg" }, + { + "_uid": "d9e3566a-a154-4fac-9517-c6948ff7cf7d", + "columns": [], + "component": "threeDElement", + "marginTop": "base", + "threeDModel": "brand", + "marginBottom": "base" + }, + { + "_uid": "43139479-f918-4519-b1e2-2874edcfcb94", + "columns": [], + "component": "threeDElement", + "marginTop": "base", + "threeDModel": "kubik-rubik", + "marginBottom": "base" + }, + { + "_uid": "c6d3bc1e-5ce9-4f8b-9334-6c936417fb3a", + "link": [ + { + "_uid": "5429c52c-c60c-4e82-8902-541cc0a9e614", + "link": { + "id": "5d416347-de08-4adb-b496-00b0a083de3a", + "url": "", + "linktype": "story", + "fieldtype": "multilink", + "cached_url": "blog" + }, + "text": "Take your shot", + "variant": "ghost-dark", + "component": "link" + } + ], + "component": "stepGuide", + "marginTop": "base", + "marginBottom": "base", + "stepGuideItem": [ + { + "_uid": "35748222-6c20-4b60-a559-55ac1e61ef96", + "text": " Add your first product", + "image": [ + { + "_uid": "8b5b2c0c-6e77-4a82-9ad2-8fdb8c7a100c", + "asset": { + "id": 17902334, + "alt": "call us", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/960x960/6a4a666d16/call-us.svg", + "copyright": "", + "fieldtype": "asset", + "meta_data": { + "alt": "call us", + "title": "", + "source": "", + "copyright": "" + }, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "3/1" + } + ], + "number": "01", + "component": "stepGuideItem" + }, + { + "_uid": "18fa609a-8e67-468b-bb10-09b0eecde4ef", + "text": "Customize your site", + "image": [ + { + "_uid": "d365c5ab-bfd6-45c6-b32c-751dc3354c5c", + "asset": { + "id": 17902335, + "alt": "Notion Office Cubicle", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/960x960/6f9f80538d/notion-office-cubicle.svg", + "copyright": "", + "fieldtype": "asset", + "meta_data": { + "alt": "Notion Office Cubicle", + "title": "", + "source": "", + "copyright": "" + }, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "16/9" + } + ], + "number": "02", + "component": "stepGuideItem" + }, + { + "_uid": "71d9d2f8-8b28-48cc-bc8a-5770b0c06e91", + "text": "Set up payments", + "image": [ + { + "_uid": "58a0c4c7-ed78-4bff-9b0a-cb4224ebc641", + "asset": { + "id": 17902333, + "alt": "grow", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/960x960/1434ff31bc/grow.svg", + "copyright": "", + "fieldtype": "asset", + "meta_data": { + "alt": "grow", + "title": "", + "source": "", + "copyright": "" + }, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "16/9" + } + ], + "number": "03", + "component": "stepGuideItem" + } + ] + }, + { + "_uid": "b4501ba5-a0ae-452d-bb61-fca7c9edf808", + "tiers": [ + { + "_uid": "8b5c5f15-664b-4aef-8f4b-2ceddc78c9cd", + "icon": [ + { + "_uid": "cd248c62-ce46-4dca-bcb7-b0672c345ecb", + "asset": { + "id": 17887678, + "alt": "", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/68x80/a59904240e/personal.png", + "copyright": "", + "fieldtype": "asset", + "meta_data": {}, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "auto" + } + ], + "link": [ + { + "_uid": "be63e7c4-ecd2-4ad0-9928-46757ccba0c1", + "link": { + "id": "19601884-a1af-4b99-bd95-1a3ca01d5b7a", + "url": "", + "linktype": "story", + "fieldtype": "multilink", + "cached_url": "home" + }, + "text": "Sign up", + "variant": "ghost", + "component": "link" + } + ], + "name": "Free", + "price": "0", + "popular": false, + "features": [ + { + "_uid": "daa76aed-3746-48f1-863b-4d9dd0e833fd", + "text": "Collaborative workspace", + "component": "pricingTierFeature" + }, + { + "_uid": "1a197039-e74f-4446-98d5-53a4a27e7b2e", + "text": "Integrate with Slack, GitHub & more", + "component": "pricingTierFeature" + }, + { + "_uid": "adae920f-a85d-4731-8a5c-2366d6dd896c", + "text": "Basic page analytics", + "component": "pricingTierFeature" + }, + { + "_uid": "6911f373-b7fe-4fa8-ade0-48285a6b47d5", + "text": "7 day page history", + "component": "pricingTierFeature" + }, + { + "_uid": "08b6beb3-f786-401a-96cd-48d37cd5dd58", + "text": "Invite 10 guests", + "component": "pricingTierFeature" + } + ], + "component": "pricingTier", + "description": "For individuals to organize personal projects and life" + }, + { + "_uid": "8691ad32-a839-419b-b67b-fbb125e15135", + "icon": [ + { + "_uid": "0cbb9308-70ed-440c-9901-9fda00362536", + "asset": { + "id": 17887679, + "alt": "", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/86x80/d9b65aa6fe/pro.png", + "copyright": "", + "fieldtype": "asset", + "meta_data": {}, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "auto" + } + ], + "link": [ + { + "_uid": "2233c43d-3681-4932-a13b-8cce9024fec9", + "link": { + "id": "19601884-a1af-4b99-bd95-1a3ca01d5b7a", + "url": "", + "linktype": "story", + "fieldtype": "multilink", + "cached_url": "home" + }, + "text": "Get started", + "variant": "ghost-dark", + "component": "link" + } + ], + "name": "Plus", + "price": "9,5", + "popular": true, + "features": [ + { + "_uid": "93ab7175-1744-4157-94f2-68af0b44787f", + "text": "Everything in Free +", + "component": "pricingTierFeature" + }, + { + "_uid": "1f8ee345-9583-4ead-8f2d-24058aec8bcd", + "text": "Unlimited blocks for teams", + "component": "pricingTierFeature" + }, + { + "_uid": "e04ed840-bf79-4c53-aa8a-7e705d542fb0", + "text": "Unlimited file uploads", + "component": "pricingTierFeature" + }, + { + "_uid": "d5f112d1-5eea-40a0-a629-7b4830182442", + "text": "30 day page history", + "component": "pricingTierFeature" + }, + { + "_uid": "18416b01-b34c-4e95-856f-9aaa1ab6660a", + "text": "Invite 100 guests", + "component": "pricingTierFeature" + }, + { + "_uid": "1b5273ef-e000-4b35-ada6-6ff76d209111", + "text": "Synced databases with 3rd party apps", + "component": "pricingTierFeature" + }, + { + "_uid": "e73d1976-7a24-460c-a379-0f740a76ae92", + "text": "Custom websites", + "component": "pricingTierFeature" + }, + { + "_uid": "6709a79a-a33d-4cd9-8e16-e1e7df61e7d1", + "text": "Custom automations", + "component": "pricingTierFeature" + }, + { + "_uid": "ab0dbc44-b1e6-4806-b08b-caa879a87048", + "text": "Charts & dashboards", + "component": "pricingTierFeature" + } + ], + "component": "pricingTier", + "description": "For small teams and professionals to work together" + }, + { + "_uid": "c11b36f5-16c7-4f64-adda-323000661d94", + "icon": [ + { + "_uid": "201ac33b-7434-4589-beff-81af26113c33", + "asset": { + "id": 17887681, + "alt": "", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/72x80/4229f5e65b/team.png", + "copyright": "", + "fieldtype": "asset", + "meta_data": {}, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "auto" + } + ], + "link": [ + { + "_uid": "27d78bdc-ce93-40b0-8e18-d2a19a7373f0", + "link": { + "id": "19601884-a1af-4b99-bd95-1a3ca01d5b7a", + "url": "", + "linktype": "story", + "fieldtype": "multilink", + "cached_url": "home" + }, + "text": "Get started", + "variant": "ghost", + "component": "link" + } + ], + "name": "Business", + "price": "14", + "popular": false, + "features": [ + { + "_uid": "0aeb1d1a-c095-481d-b82a-f87deb75539c", + "text": "Everything in Plus +", + "component": "pricingTierFeature" + }, + { + "_uid": "5df353b6-9c56-465d-8dc4-d8e7b739cc74", + "text": "SAML SSO", + "component": "pricingTierFeature" + }, + { + "_uid": "50b68f1d-1264-4c06-b295-080a84b94a7a", + "text": "Private teamspaces", + "component": "pricingTierFeature" + }, + { + "_uid": "f9153bd4-cdd9-4362-b1cb-3103014b2cc4", + "text": "Bulk PDF export", + "component": "pricingTierFeature" + }, + { + "_uid": "7f37be1a-c308-4806-a7c4-765676044282", + "text": "Advanced page analytics", + "component": "pricingTierFeature" + }, + { + "_uid": "4fb885e6-2239-4e04-bee7-4b945b2eef22", + "text": "90 day page history", + "component": "pricingTierFeature" + }, + { + "_uid": "4a176ea2-92c0-4155-9453-bc87f76e7156", + "text": "Invite 250 guests", + "component": "pricingTierFeature" + } + ], + "component": "pricingTier", + "description": "For growing businesses to streamline teamwork" + }, + { + "_uid": "4ca76929-e827-44d0-b38b-78d744af8f54", + "icon": [ + { + "_uid": "bdf737f1-bbe6-402f-90bc-b57434bea1ea", + "asset": { + "id": 17887680, + "alt": "", + "name": "", + "focus": "", + "title": "", + "source": "", + "filename": "https://a.storyblok.com/f/293915/84x80/8b7995cd2e/enterprise.png", + "copyright": "", + "fieldtype": "asset", + "meta_data": {}, + "is_external_url": false + }, + "component": "image", + "aspectRatio": "auto" + } + ], + "link": [ + { + "_uid": "b91aea3a-0bac-47d7-a968-df5e01a24071", + "link": { + "id": "5d416347-de08-4adb-b496-00b0a083de3a", + "url": "", + "linktype": "story", + "fieldtype": "multilink", + "cached_url": "blog" + }, + "text": "Contact Sales", + "variant": "ghost", + "component": "link" + } + ], + "name": "Enterprise", + "price": "", + "popular": false, + "features": [ + { + "_uid": "de2c7aa6-f8f9-4adf-9057-bc15676767cb", + "text": "Everything in Business +", + "component": "pricingTierFeature" + }, + { + "_uid": "b920e2d6-760f-47e1-bd2c-8a6193087f3c", + "text": "User provisioning (SCIM)", + "component": "pricingTierFeature" + }, + { + "_uid": "8439ee93-995b-4581-8a7d-ac87fb7d03ee", + "text": "Advanced security & controls", + "component": "pricingTierFeature" + }, + { + "_uid": "fcd9a4b1-793a-4be8-b0da-8d4fe7c8261c", + "text": "Audit log", + "component": "pricingTierFeature" + }, + { + "_uid": "3e212dd3-2490-4bbb-a3cb-8b40f675062a", + "text": "Customer success manager", + "component": "pricingTierFeature" + }, + { + "_uid": "5acc56cb-3d7f-4c9f-a8b5-a9777bcfc181", + "text": "Workspace analytics", + "component": "pricingTierFeature" + }, + { + "_uid": "493c7815-dbf3-4302-a61f-474f674b96a8", + "text": "Unlimited page history", + "component": "pricingTierFeature" + }, + { + "_uid": "fa3f5549-29e0-4791-87f1-5963c931dd8f", + "text": "Security & Compliance integrations", + "component": "pricingTierFeature" + }, + { + "_uid": "179bdf45-3bdd-406b-8c0c-33d95122aa04", + "text": "Invite 250 guests", + "component": "pricingTierFeature" + } + ], + "component": "pricingTier", + "description": "For organizations to operate with scalability, control, and security" + } + ], + "component": "pricing", + "extraService": [ + { + "_uid": "aa8eee91-81e8-452a-b372-659ae48fcb34", + "cost": "10", + "text": "Add AI", + "component": "pricingExtraService" + } + ], + "extraServiceEnabled": true, + "yearlyDiscountPercentage": "20" + }, { "_uid": "9bd6ae54-2eb3-46fc-ab31-f93c0bc4f5fa", "theme": "dark", @@ -4296,7 +4775,7 @@ "component_id": 5960538, "space_id": 293915, "created_at": "2024-09-12T12:39:47.903Z", - "updated_at": "2024-10-09T16:15:58.466Z", + "updated_at": "2024-11-04T08:07:50.258Z", "image": "//a.storyblok.com/f/293915/x/63ad25deab/screenshot-2024-09-12-at-14-39-24.png", "color": "", "icon": "", diff --git a/packages/ui/components/sections/hero/index.tsx b/packages/ui/components/sections/hero/index.tsx index 9ea8099..1b1312b 100644 --- a/packages/ui/components/sections/hero/index.tsx +++ b/packages/ui/components/sections/hero/index.tsx @@ -7,7 +7,7 @@ export function Hero({ title, text, image, links }: IHeroProps) { return (
-

{title}

+

{title}

{links.map((link) => ( diff --git a/packages/ui/components/sections/stepGuide/index.tsx b/packages/ui/components/sections/stepGuide/index.tsx index 026d59d..50893b4 100644 --- a/packages/ui/components/sections/stepGuide/index.tsx +++ b/packages/ui/components/sections/stepGuide/index.tsx @@ -46,7 +46,7 @@ export function StepGuide({ link, items }: IStepGuideProps) {
{number}
-

+

{text}

diff --git a/packages/ui/components/sections/threeDElement/index.tsx b/packages/ui/components/sections/threeDElement/index.tsx index 693dcd0..e2be38d 100644 --- a/packages/ui/components/sections/threeDElement/index.tsx +++ b/packages/ui/components/sections/threeDElement/index.tsx @@ -14,6 +14,8 @@ const MODELS_MAP: Record = { export function ThreeDElement({ model }: IThreeDElementProps) { const ModelComponent = MODELS_MAP[model]; + if (!ModelComponent) return null; + return (
diff --git a/packages/ui/components/ui/link/index.tsx b/packages/ui/components/ui/link/index.tsx index 89199d8..e365a6f 100644 --- a/packages/ui/components/ui/link/index.tsx +++ b/packages/ui/components/ui/link/index.tsx @@ -9,7 +9,7 @@ import { // todo: rework to be button instead of link (and use asLink/Slot pattern) export const LinkVariantsClassNames: ILinkVariantsClassNames = { - [LinkVariant.Default]: "", + [LinkVariant.Default]: "text-textColor", [LinkVariant.Primary]: "inline-flex items-center justify-center px-5 py-3 text-base font-medium text-center text-bgColor rounded-lg bg-primaryColor hover:outline", [LinkVariant.Secondary]: diff --git a/turbo/generators/config.ts b/turbo/generators/config.ts index 6ead3b5..9e7cf6f 100644 --- a/turbo/generators/config.ts +++ b/turbo/generators/config.ts @@ -1,21 +1,6 @@ import type { PlopTypes } from "@turbo/gen"; -const componentNamePrompt = { - type: "input", - name: "sectionName", - message: "What is the name of the new section?", - validate: (input: string) => { - if (!input) { - return "section name is required"; - } - - if (input.split(" ").length > 1) { - return "section name should be a single word"; - } - - return true; - }, -}; +import { componentNamePrompt, createUISectionActions } from "./constants"; export default function generator(plop: PlopTypes.NodePlopAPI): void { plop.setHelper("capitialize", (str: string) => { @@ -29,30 +14,14 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void { plop.setGenerator("UI", { description: "Create a new UI component", prompts: [componentNamePrompt], - actions: [ - { - type: "add", - path: "{{ turbo.paths.root }}/packages/ui/components/ui/{{ capitialize sectionName }}/index.tsx", - templateFile: "templates/uiComponent.hbs", - }, - { - type: "add", - path: "{{ turbo.paths.root }}/packages/ui/components/ui/{{ capitialize sectionName }}/types.ts", - templateFile: "templates/uiComponentTypes.hbs", - }, - { - type: "modify", - path: "{{ turbo.paths.root }}/packages/ui/index.tsx", - pattern: /(\/\/ end component exports)/g, - template: `export * from "./components/ui/{{ sectionName }}"\n$1`, - }, - ], + actions: createUISectionActions, }); plop.setGenerator("Storyblok", { description: "Create a new content section", prompts: [componentNamePrompt], actions: [ + ...createUISectionActions, { type: "add", path: "{{ turbo.paths.root }}/apps/storyblok/src/contentSections/{{ capitialize sectionName }}/index.tsx", @@ -82,16 +51,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void { description: "Create a new content section", prompts: [componentNamePrompt], actions: [ - { - type: "add", - path: "{{ turbo.paths.root }}/packages/ui/components/sections/{{ sectionName }}/index.tsx", - templateFile: "templates/uiSection.hbs", - }, - { - type: "add", - path: "{{ turbo.paths.root }}/packages/ui/components/sections/{{ sectionName }}/types.ts", - templateFile: "templates/uiSectionProps.hbs", - }, + ...createUISectionActions, { type: "add", path: "{{ turbo.paths.root }}/apps/sanity/src/contentSections/{{ capitialize sectionName }}/index.tsx", @@ -121,12 +81,6 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void { template: "'section.{{ loweraseFirstLetter sectionName }}': {{ capitialize sectionName }},\n$1", }, - { - type: "modify", - path: "{{ turbo.paths.root }}/packages/ui/index.tsx", - pattern: /(\/\/ end component exports)/g, - template: `export * from "./components/sections/{{ sectionName }}"\n$1`, - }, { type: "modify", path: "{{ turbo.paths.root }}/apps/sanity/src/lib/schemas/sections.ts", diff --git a/turbo/generators/constants.ts b/turbo/generators/constants.ts new file mode 100644 index 0000000..1c7d590 --- /dev/null +++ b/turbo/generators/constants.ts @@ -0,0 +1,35 @@ +export const componentNamePrompt = { + type: "input", + name: "sectionName", + message: "What is the name of the new section?", + validate: (input: string) => { + if (!input) { + return "section name is required"; + } + + if (input.split(" ").length > 1) { + return "section name should be a single word"; + } + + return true; + }, +}; + +export const createUISectionActions = [ + { + type: "add", + path: "{{ turbo.paths.root }}/packages/ui/components/sections/{{ sectionName }}/index.tsx", + templateFile: "templates/uiSection.hbs", + }, + { + type: "add", + path: "{{ turbo.paths.root }}/packages/ui/components/sections/{{ sectionName }}/types.ts", + templateFile: "templates/uiSectionProps.hbs", + }, + { + type: "modify", + path: "{{ turbo.paths.root }}/packages/ui/index.tsx", + pattern: /(\/\/ end component exports)/g, + template: `export * from "./components/sections/{{ sectionName }}"\n$1`, + }, +]; diff --git a/turbo/generators/templates/storyblokSection.hbs b/turbo/generators/templates/storyblokSection.hbs index 5c39ccb..916e24b 100644 --- a/turbo/generators/templates/storyblokSection.hbs +++ b/turbo/generators/templates/storyblokSection.hbs @@ -2,26 +2,19 @@ import EmptyBlock from "@shared/ui/components/EmptyBlock"; import { {{capitialize sectionName}} as {{capitialize sectionName}}UI } from "@shared/ui"; -import { prepareImageProps } from "@/lib/adapters/prepareImageProps"; -import { prepareLinkProps } from "@/lib/adapters/prepareLinkProps"; -import { prepareRichTextProps } from "@/lib/adapters/prepareRichTextProps"; import SectionContainer from "@/components/SectionContainer"; import type { I{{capitialize sectionName}}Props } from "./types"; export default function {{capitialize sectionName}}({ blok }: I{{capitialize sectionName}}Props) { - const { text, image, link } = blok; + const { title } = blok; - if (text.length === 0 && image.length === 0 && link.length === 0) + if (!title) return ; return ( - <{{capitialize sectionName}}UI - text={prepareRichTextProps(text[0])} - image={prepareImageProps(image[0])} - link={prepareLinkProps(link[0])} - /> + <{{capitialize sectionName}}UI title={title} /> ); } diff --git a/turbo/generators/templates/uiComponent.hbs b/turbo/generators/templates/uiComponent.hbs deleted file mode 100644 index 4e3155d..0000000 --- a/turbo/generators/templates/uiComponent.hbs +++ /dev/null @@ -1,7 +0,0 @@ -import type { I{{capitialize sectionName}}Props } from "./types" export function -{{capitialize sectionName}} -({ title }: I{{capitialize sectionName}}Props) { return ( -
- new UI component: Table title: {title || 'title not provided'} -
-) } \ No newline at end of file diff --git a/turbo/generators/templates/uiComponentTypes.hbs b/turbo/generators/templates/uiComponentTypes.hbs deleted file mode 100644 index 5665321..0000000 --- a/turbo/generators/templates/uiComponentTypes.hbs +++ /dev/null @@ -1 +0,0 @@ -export interface I{{capitialize sectionName}}Props { title: string; } \ No newline at end of file diff --git a/turbo/generators/templates/uiSection.hbs b/turbo/generators/templates/uiSection.hbs index e380367..4ff6480 100644 --- a/turbo/generators/templates/uiSection.hbs +++ b/turbo/generators/templates/uiSection.hbs @@ -1,13 +1,12 @@ -import React from "react"; -import type { I{{ capitialize sectionName }}Props } from "./types"; +import type { I{{capitialize sectionName}}Props } from "./types" -// todo: remove React.FC<> and replace with common function and type -export const {{ capitialize sectionName }}: React.FC = ({ title }) => { - return ( -
-
- {title} -
-
- ) -} \ No newline at end of file +export function {{capitialize sectionName}}({ title }: I{{capitialize sectionName}}Props) { + return ( +
+
+ {title} +
+
+ ); +} + \ No newline at end of file diff --git a/turbo/generators/templates/uiSectionProps.hbs b/turbo/generators/templates/uiSectionProps.hbs index d186ba5..24766bc 100644 --- a/turbo/generators/templates/uiSectionProps.hbs +++ b/turbo/generators/templates/uiSectionProps.hbs @@ -1,3 +1,3 @@ export interface I{{ capitialize sectionName }}Props { - title: string; -} \ No newline at end of file + title: string; +}