diff --git a/apps/sanity/package.json b/apps/sanity/package.json index 04b96d6..dcdc05b 100644 --- a/apps/sanity/package.json +++ b/apps/sanity/package.json @@ -12,6 +12,7 @@ "gen:types": "pnpm extract-schema && pnpm sanity typegen generate" }, "dependencies": { + "@focus-reactive/sanity-plugin-cms-kit": "^0.1.0", "@portabletext/react": "^3.1.0", "@sanity/client": "^6.21.1", "@sanity/image-url": "^1.0.2", diff --git a/apps/sanity/sanity.cli.ts b/apps/sanity/sanity.cli.ts index 644b8ff..d5acc40 100644 --- a/apps/sanity/sanity.cli.ts +++ b/apps/sanity/sanity.cli.ts @@ -1,8 +1,10 @@ -import { loadEnvConfig } from "@next/env"; +// import { loadEnvConfig } from "@next/env"; import { defineCliConfig } from "sanity/cli"; -const dev = process.env.NODE_ENV !== "production"; -loadEnvConfig(__dirname, dev, { info: () => null, error: console.error }); +console.log("add logic to load ebv variables"); + +// const dev = process.env.NODE_ENV !== "production"; +// loadEnvConfig(__dirname, dev, { info: () => null, error: console.error }); // @TODO report top-level await bug // Using a dynamic import here as `loadEnvConfig` needs to run before this file is loaded diff --git a/apps/sanity/sanity.config.ts b/apps/sanity/sanity.config.ts index cfd7a8e..b12c255 100644 --- a/apps/sanity/sanity.config.ts +++ b/apps/sanity/sanity.config.ts @@ -1,3 +1,4 @@ +import { CMSKitContentBlocks } from "@focus-reactive/sanity-plugin-cms-kit"; import { visionTool } from "@sanity/vision"; import { pages } from "@tinloof/sanity-studio"; import { defineConfig } from "sanity"; @@ -40,5 +41,6 @@ export default defineConfig({ structureTool(), visionTool({ defaultApiVersion: config.sanity.apiVersion }), simplerColorInput(), + CMSKitContentBlocks({}), ], }); diff --git a/apps/sanity/src/components/Footer/templates/footer.json b/apps/sanity/src/components/Footer/templates/footer.json deleted file mode 100644 index 07ae6eb..0000000 --- a/apps/sanity/src/components/Footer/templates/footer.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_type": "section.footer", - "copywriteText": "Flowbite™. All Rights Reserved.", - "links": [ - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "About", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "Premium", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "Campaigns", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "Blog", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "Affiliate Program", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "FAQs", - "type": "url", - "variant": "footerNav" - }, - { - "href": "https://github.com/focusreactive/cms-kit", - "target": "_self", - "text": "Contact", - "type": "url", - "variant": "footerNav" - } - ], - "text": { - "_type": "customRichText", - "alignVariant": "center", - "text": [ - { - "items": [ - { - "image": { - "_type": "customImage", - "aspectRatio": "3/2", - "height": 200, - "image": { - "_type": "image", - "alt": "fr", - "asset": { - "_ref": "image-ee91bcb6817640ca3892a4d97ef14971f25233d6-345x160-png", - "_type": "reference" - } - } - }, - "link": { - "_type": "customLink", - "href": "https://focusreactive.com", - "target": "_blank", - "type": "url", - "variant": "primary" - }, - "type": "logoLink" - } - ], - "theme": "dark", - "variant": "center" - }, - { - "children": [ - { - "marks": [], - "text": "Open-source library of over 400+ web components and interactive elements built for better web." - } - ], - "markDefs": [], - "style": "normal" - } - ] - }, - "theme": "dark" -} diff --git a/apps/sanity/src/components/Footer/templates/index.ts b/apps/sanity/src/components/Footer/templates/index.ts deleted file mode 100644 index b9139b2..0000000 --- a/apps/sanity/src/components/Footer/templates/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; - -import footer from "./footer.json"; - -export const footerTemplates = [ - createTemplate({ - json: footer, - title: "Footer with links", - description: "dakwefwef", - category: "footer", - }), -]; diff --git a/apps/sanity/src/components/Header/templates/header.json b/apps/sanity/src/components/Header/templates/header.json deleted file mode 100644 index 0718caa..0000000 --- a/apps/sanity/src/components/Header/templates/header.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_type": "section.header", - "links": [ - { - "_type": "customLink", - "target": "_self", - "text": "Home", - "type": "internal", - "url": { - "_ref": "07a85c5b-8042-4210-ae90-11077c1f47b6", - "_type": "reference" - }, - "variant": "headerNav" - }, - { - "_type": "customLink", - "target": "_self", - "text": "Demo", - "type": "internal", - "url": { - "_ref": "07a85c5b-8042-4210-ae90-11077c1f47b6", - "_type": "reference" - }, - "variant": "headerNav" - }, - { - "_type": "customLink", - "href": "/studio", - "target": "_self", - "text": "Sanity Studio", - "type": "url", - "url": { - "_ref": "07a85c5b-8042-4210-ae90-11077c1f47b6", - "_type": "reference" - }, - "variant": "headerNav" - }, - { - "_type": "customLink", - "href": "https://github.com/focusreactive/cms-kit-sanity/wiki/init_system", - "target": "_self", - "text": "Docs", - "type": "url", - "variant": "headerNav" - }, - { - "_type": "customLink", - "href": "https://github.com/focusreactive/cms-kit-sanity/wiki/init_system", - "target": "_self", - "text": "Github", - "type": "url", - "variant": "headerNav" - }, - { - "_type": "customLink", - "href": "https://github.com/focusreactive/cms-kit-sanity/wiki/init_system", - "target": "_self", - "text": "About", - "type": "url", - "variant": "headerNav" - } - ], - "theme": "light" -} diff --git a/apps/sanity/src/components/Header/templates/index.ts b/apps/sanity/src/components/Header/templates/index.ts deleted file mode 100644 index ed8bf11..0000000 --- a/apps/sanity/src/components/Header/templates/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; - -import header from "./header.json"; - -export const headerTemplates = [ - createTemplate({ - json: header, - title: "Header with links", - description: "dakwefwef", - category: "header", - }), -]; diff --git a/apps/sanity/src/components/Page/schema.ts b/apps/sanity/src/components/Page/schema.ts index 79485b7..34d64ff 100644 --- a/apps/sanity/src/components/Page/schema.ts +++ b/apps/sanity/src/components/Page/schema.ts @@ -3,14 +3,13 @@ import { commonGroups, themeField, } from "@/contentSections/commonFields"; -// import { sectionsPresets } from "@/contentSections/presets"; +import { sectionsPresets } from "@/contentSections/presets"; +import { defineBlocksField } from "@focus-reactive/sanity-plugin-cms-kit"; import { definePathname } from "@tinloof/sanity-studio"; import { defineField, defineType, type FieldGroupDefinition } from "sanity"; import sections from "@/lib/schemas/sections"; -// import { componentsWithBlocksInput } from "@/lib/templateSelectorInput"; - export default defineType({ type: "document", name: "page", @@ -36,17 +35,17 @@ export default defineType({ group: CommonGroup.Content, validation: (Rule) => Rule.required(), }), - defineField({ + defineBlocksField({ name: "sectionsBody", - title: "Sections", - type: "array", - group: CommonGroup.Content, + // add fields to the package + // title: "Sections", + // group: CommonGroup.Content, of: sections.map((section) => ({ type: section.name, })), - // components: componentsWithBlocksInput({ - // presets: Object.values(sectionsPresets).flat(), - // }), + options: { + presets: Object.values(sectionsPresets).flat(), + }, }), defineField({ name: "footer", diff --git a/apps/sanity/src/contentSections/Blog/templates/index.ts b/apps/sanity/src/contentSections/Blog/templates/index.ts index dbe9656..0991950 100644 --- a/apps/sanity/src/contentSections/Blog/templates/index.ts +++ b/apps/sanity/src/contentSections/Blog/templates/index.ts @@ -1,19 +1,19 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; -import withImage from "./with-images.json"; -import withoutImage from "./without-images.json"; +// import { createTemplate } from "@/lib/utils"; -export const blogTemplates = [ - createTemplate({ - json: withImage, - title: "Blog section with images", - description: "desc1", - category: "blog", - }), - createTemplate({ - json: withoutImage, - title: "Blog section without images", - description: "desc2", - category: "blog", - }), +// import withImage from "./with-images.json"; +// import withoutImage from "./without-images.json"; + +export const blogTemplates: Preset[] = [ + // createTemplate({ + // title: "Blog section with images", + // json: withImage, + // category: "blog", + // }), + // createTemplate({ + // title: "Blog section without images", + // json: withoutImage, + // category: "blog", + // }), ]; diff --git a/apps/sanity/src/contentSections/CardsGrid/templates/default-preview.png b/apps/sanity/src/contentSections/CardsGrid/templates/default-preview.png new file mode 100644 index 0000000..2106964 Binary files /dev/null and b/apps/sanity/src/contentSections/CardsGrid/templates/default-preview.png differ diff --git a/apps/sanity/src/contentSections/CardsGrid/templates/default.json b/apps/sanity/src/contentSections/CardsGrid/templates/default.json new file mode 100644 index 0000000..a7326ad --- /dev/null +++ b/apps/sanity/src/contentSections/CardsGrid/templates/default.json @@ -0,0 +1,98 @@ +{ + "marginBottom": "base", + "_key": "bb086e238e49", + "items": [ + { + "image": { + "height": 50, + "image": { + "_type": "image", + "alt": "icon", + "asset": { + "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", + "_type": "reference" + } + }, + "_type": "customImage", + "aspectRatio": "1/1" + }, + "_type": "defaultCard", + "link": { + "target": "_self", + "size": "base", + "_type": "customLink", + "url": null, + "variant": "default", + "text": "link text", + "type": "internal" + }, + "description": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.", + "style": "icon-title-inline", + "_key": "27dfd9f9f0e7", + "title": "initial title" + }, + { + "description": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.", + "style": "icon-title-inline", + "_key": "b40f414ea8fa644e894e76394547344f", + "title": "initial title", + "image": { + "image": { + "asset": { + "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", + "_type": "reference" + }, + "_type": "image", + "alt": "icon" + }, + "_type": "customImage", + "aspectRatio": "1/1", + "height": 50 + }, + "_type": "defaultCard", + "link": { + "variant": "default", + "text": "link text", + "type": "internal", + "target": "_self", + "url": null, + "size": "base", + "_type": "customLink" + } + }, + { + "link": { + "_type": "customLink", + "variant": "default", + "text": "link text", + "type": "internal", + "target": "_self", + "url": null, + "size": "base" + }, + "description": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups", + "style": "icon-title-inline", + "_key": "4bb5da5b8b099082b60f068741dce0d0", + "title": "initial title", + "image": { + "_type": "customImage", + "aspectRatio": "1/1", + "height": 50, + "image": { + "_type": "image", + "alt": "icon", + "asset": { + "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", + "_type": "reference" + } + } + }, + "_type": "defaultCard" + } + ], + "marginTop": "base", + "maxWidth": "base", + "backgroundColor": "none", + "columns": 3, + "_type": "section.cardsGrid" +} diff --git a/apps/sanity/src/contentSections/CardsGrid/templates/index.ts b/apps/sanity/src/contentSections/CardsGrid/templates/index.ts index c7d3207..7d023a6 100644 --- a/apps/sanity/src/contentSections/CardsGrid/templates/index.ts +++ b/apps/sanity/src/contentSections/CardsGrid/templates/index.ts @@ -1,12 +1,15 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; -import oneColumns from "./one-column.json"; +import { createTemplate } from "@/lib/utils"; -export const cardsGridsTemplates = [ +import defaultPreview from "./default-preview.png"; +import defaultTemplate from "./default.json"; + +export const cardsGridsTemplates: Preset[] = [ createTemplate({ - json: oneColumns, - title: "One column cards grid", - description: "one columns grid ", - category: "grid", + title: "Three columns cards grid", + json: defaultTemplate, + category: "cardsGrids", + screenshot: defaultPreview.src, }), ]; diff --git a/apps/sanity/src/contentSections/CardsGrid/templates/one-column.json b/apps/sanity/src/contentSections/CardsGrid/templates/one-column.json deleted file mode 100644 index c56433e..0000000 --- a/apps/sanity/src/contentSections/CardsGrid/templates/one-column.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_type": "section.cardsGrid", - "columns": 2, - "items": [ - { - "_type": "defaultCard", - "description": "Deploy faster", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 15, - "image": { - "_type": "image", - "alt": "wd", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-title-inline", - "title": "Push to deploy" - }, - { - "_type": "defaultCard", - "description": "Deploy faster Everything you need to deploy your app Quis tellus eget adipiscing convallis sit sit eget aliquet quis. Suspendisse eget egestas a elementum pulvinar et feugiat blandit at. In mi viverra elit nunc.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 15, - "image": { - "_type": "image", - "alt": "wd", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-title-inline", - "title": "Push to deploy" - }, - { - "_type": "defaultCard", - "description": "Deploy faster. Everything you need to deploy your app Quis tellus eget adipiscing convallis sit sit eget aliquet quis. Suspendisse eget egestas a elementum pulvinar et feugiat blandit at. In mi viverra elit nunc.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 15, - "image": { - "_type": "image", - "alt": "wd", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-title-inline", - "title": "Push to deploy" - }, - { - "_type": "defaultCard", - "description": "Deploy faster Everything you need to deploy your app Quis tellus eget adipiscing convallis sit sit eget aliquet quis. Suspendisse eget egestas a elementum pulvinar et feugiat blandit at. In mi viverra elit nunc.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 15, - "image": { - "_type": "image", - "alt": "wd", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-title-inline", - "title": "Push to deploy" - } - ], - "theme": "light" -} diff --git a/apps/sanity/src/contentSections/Copy/templates/default-preview.png b/apps/sanity/src/contentSections/Copy/templates/default-preview.png new file mode 100644 index 0000000..f8ccad3 Binary files /dev/null and b/apps/sanity/src/contentSections/Copy/templates/default-preview.png differ diff --git a/apps/sanity/src/contentSections/Copy/templates/default.json b/apps/sanity/src/contentSections/Copy/templates/default.json new file mode 100644 index 0000000..9bc6b92 --- /dev/null +++ b/apps/sanity/src/contentSections/Copy/templates/default.json @@ -0,0 +1,81 @@ +{ + "marginBottom": "base", + "_key": "54c4351ff481", + "isReversedOnMobile": false, + "marginTop": "base", + "maxWidth": "base", + "backgroundColor": "none", + "columns": [ + { + "_key": "55ba7409e7fb", + "removeInnerMargins": false, + "_type": "customRichText", + "alignVariant": "left", + "text": [ + { + "children": [ + { + "_type": "span", + "marks": [], + "text": "title", + "_key": "036d8a93fa5d" + } + ], + "_type": "block", + "style": "h2", + "_key": "88ee66df51fa", + "markDefs": [] + }, + { + "_type": "block", + "style": "normal", + "_key": "f3948c81e5c7", + "markDefs": [], + "children": [ + { + "_key": "b327250337940", + "_type": "span", + "marks": ["strong", "em"], + "text": "Lorem ipsum" + }, + { + "_type": "span", + "marks": ["strong"], + "text": " is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.", + "_key": "b327250337941" + } + ] + }, + { + "_type": "block", + "style": "normal", + "_key": "a39782f3110a", + "markDefs": [], + "children": [ + { + "_type": "span", + "marks": [], + "text": "", + "_key": "81df362565120" + } + ] + }, + { + "children": [ + { + "_type": "span", + "marks": ["underline"], + "text": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.", + "_key": "92873e08cb300" + } + ], + "_type": "block", + "style": "normal", + "_key": "491288596ec9", + "markDefs": [] + } + ] + } + ], + "_type": "section.copy" +} diff --git a/apps/sanity/src/contentSections/Copy/templates/image-cards-grid.json b/apps/sanity/src/contentSections/Copy/templates/image-cards-grid.json deleted file mode 100644 index 995bf99..0000000 --- a/apps/sanity/src/contentSections/Copy/templates/image-cards-grid.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "_type": "section.copy", - "columns": [ - { - "_type": "customRichText", - "alignVariant": "center", - "removeInnerMargins": false, - "text": [ - { - "_type": "block", - "children": [ - { - "_type": "span", - "marks": ["strong"], - "text": "Deploy faster" - } - ], - "markDefs": [], - "style": "normal" - }, - { - "_type": "block", - "children": [ - { - "_type": "span", - "marks": [], - "text": "A better workflow" - } - ], - "markDefs": [], - "style": "h2" - }, - { - "_type": "block", - "children": [ - { - "_type": "span", - "marks": [], - "text": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Maiores impedit perferendis suscipit eaque, iste dolor cupiditate blanditiis ratione." - } - ], - "markDefs": [], - "style": "normal" - }, - { - "_type": "section.cardsGrid", - "columns": 2, - "items": [ - { - "_type": "defaultCard", - "description": "Given the task of adding specific import statements to existing files, both Plop and Hygen can handle this requirement effectively. Let's look at how each solution can address this need.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 20, - "image": { - "_type": "image", - "alt": "12", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-left-with-background", - "title": "Feature example" - }, - { - "_type": "defaultCard", - "description": "Given the task of adding specific import statements to existing files, both Plop and Hygen can handle this requirement effectively. Let's look at how each solution can address this need.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 20, - "image": { - "_type": "image", - "alt": "12", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-left-with-background", - "title": "Feature example" - }, - { - "_type": "defaultCard", - "description": "Given the task of adding specific import statements to existing files, both Plop and Hygen can handle this requirement effectively. Let's look at how each solution can address this need.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 20, - "image": { - "_type": "image", - "alt": "12", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-left-with-background", - "title": "Feature example" - }, - { - "_type": "defaultCard", - "description": "Given the task of adding specific import statements to existing files, both Plop and Hygen can handle this requirement effectively. Let's look at how each solution can address this need.", - "image": { - "_type": "customImage", - "aspectRatio": "1/1", - "height": 20, - "image": { - "_type": "image", - "alt": "12", - "asset": { - "_ref": "image-e41ba355dad1252ec04515b9f6a0195b31c9fbee-24x24-webp", - "_type": "reference" - } - } - }, - "style": "icon-left-with-background", - "title": "Feature example" - } - ], - "theme": "dark" - } - ] - }, - { - "_type": "customRichText", - "text": [ - { - "_type": "customImage", - "aspectRatio": "16/9", - "height": 500, - "image": { - "_type": "image", - "asset": { - "_ref": "image-3999b2b44708123af956203154160e652a3c88d5-1792x1008-webp", - "_type": "reference" - } - } - } - ] - } - ], - "isReversedOnMobile": true, - "theme": "dark" -} diff --git a/apps/sanity/src/contentSections/Copy/templates/index.ts b/apps/sanity/src/contentSections/Copy/templates/index.ts index 094ae8e..322834e 100644 --- a/apps/sanity/src/contentSections/Copy/templates/index.ts +++ b/apps/sanity/src/contentSections/Copy/templates/index.ts @@ -1,12 +1,15 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; -import centeredDark from "./image-cards-grid.json"; +import { createTemplate } from "@/lib/utils"; -export const copyTemplates = [ +import defaultPreview from "./default-preview.png"; +import defaultTemplate from "./default.json"; + +export const copyTemplates: Preset[] = [ createTemplate({ - json: centeredDark, title: "Text, cards grid and an image", - description: "dak", + json: defaultTemplate, category: "copy", + screenshot: defaultPreview.src, }), ]; diff --git a/apps/sanity/src/contentSections/Hero/templates/default-preview.png b/apps/sanity/src/contentSections/Hero/templates/default-preview.png new file mode 100644 index 0000000..44478fc Binary files /dev/null and b/apps/sanity/src/contentSections/Hero/templates/default-preview.png differ diff --git a/apps/sanity/src/contentSections/Hero/templates/default.json b/apps/sanity/src/contentSections/Hero/templates/default.json new file mode 100644 index 0000000..91947ad --- /dev/null +++ b/apps/sanity/src/contentSections/Hero/templates/default.json @@ -0,0 +1,80 @@ +{ + "_key": "cc234d717c1a", + "maxWidth": "base", + "marginTop": "base", + "_type": "section.hero", + "backgroundColor": "none", + "links": [ + { + "target": "_blank", + "size": "base", + "_type": "customLink", + "variant": "primary", + "href": "https://github.com/focusreactive/cms-kit", + "text": "Get for free", + "_key": "f040752769eb", + "type": "url" + }, + { + "type": "url", + "target": "_blank", + "size": "base", + "_type": "customLink", + "variant": "secondary", + "href": "https://focusreactive.com/#mail-us", + "text": "Request a demo", + "_key": "2e6d45a8ffb90a9d2f617459b0058096" + } + ], + "marginBottom": "base", + "text": { + "removeInnerMargins": true, + "_type": "customRichText", + "alignVariant": "left", + "text": [ + { + "_key": "803b91475d98", + "markDefs": [], + "children": [ + { + "_type": "span", + "marks": [], + "text": "In Notion, work feels better.", + "_key": "5d2397ebf0b70" + } + ], + "_type": "block", + "style": "h2" + }, + { + "markDefs": [], + "children": [ + { + "text": "With a little help from AI.", + "_key": "37bb7278b2010", + "_type": "span", + "marks": [] + } + ], + "_type": "block", + "style": "h2", + "_key": "349ddd94fa19" + } + ] + }, + "image": { + "aspectRatio": "16/9", + "height": 398, + "image": { + "alt": "hero image", + "asset": { + "_ref": "image-87bbe62c05af83adf65157b910fb734a6eca8cea-1920x1023-png", + "_type": "reference" + }, + "_type": "image" + }, + "_type": "customImage" + }, + "title": "cms-kit", + "globalData": null +} diff --git a/apps/sanity/src/contentSections/Hero/templates/index.ts b/apps/sanity/src/contentSections/Hero/templates/index.ts new file mode 100644 index 0000000..e536af6 --- /dev/null +++ b/apps/sanity/src/contentSections/Hero/templates/index.ts @@ -0,0 +1,15 @@ +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; + +import { createTemplate } from "@/lib/utils"; + +import defaultPreview from "./default-preview.png"; +import defaultTemplate from "./default.json"; + +export const heroTemplates: Preset[] = [ + createTemplate({ + title: "Hero default", + json: defaultTemplate, + category: "hero", + screenshot: defaultPreview.src, + }), +]; diff --git a/apps/sanity/src/contentSections/LinksList/templates/badge.json b/apps/sanity/src/contentSections/LinksList/templates/badge.json deleted file mode 100644 index 3a2b803..0000000 --- a/apps/sanity/src/contentSections/LinksList/templates/badge.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "_type": "section.linksList", - "alignVariant": "center", - "links": [ - { - "_type": "customLink", - "target": "_self", - "text": "Demo & Initial Project Read More →", - "type": "internal", - "url": { - "_ref": "0a28744d-602b-49a3-b91a-17a56e3c7832", - "_type": "reference" - }, - "variant": "badge" - } - ], - "theme": "dark" -} diff --git a/apps/sanity/src/contentSections/LinksList/templates/default-preview.png b/apps/sanity/src/contentSections/LinksList/templates/default-preview.png new file mode 100644 index 0000000..f4d6a06 Binary files /dev/null and b/apps/sanity/src/contentSections/LinksList/templates/default-preview.png differ diff --git a/apps/sanity/src/contentSections/LinksList/templates/default.json b/apps/sanity/src/contentSections/LinksList/templates/default.json new file mode 100644 index 0000000..c95de65 --- /dev/null +++ b/apps/sanity/src/contentSections/LinksList/templates/default.json @@ -0,0 +1,31 @@ +{ + "alignVariant": "left", + "links": [ + { + "target": "_blank", + "size": "base", + "_type": "customLink", + "variant": "primary", + "href": "https://google.com", + "text": "Get for free", + "_key": "2739e01fde20ada6117123343086ed46", + "type": "url" + }, + { + "size": "base", + "_type": "customLink", + "variant": "secondary", + "href": "https://google.com", + "text": "Get for free", + "_key": "5833c115c14e9b8bc513e387d43b3551", + "type": "url", + "target": "_blank" + } + ], + "marginBottom": "base", + "_key": "29ba8638c4e8", + "marginTop": "base", + "maxWidth": "base", + "backgroundColor": "none", + "_type": "section.linksList" +} diff --git a/apps/sanity/src/contentSections/LinksList/templates/index.ts b/apps/sanity/src/contentSections/LinksList/templates/index.ts index 6537697..5f68ac6 100644 --- a/apps/sanity/src/contentSections/LinksList/templates/index.ts +++ b/apps/sanity/src/contentSections/LinksList/templates/index.ts @@ -1,19 +1,15 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; -import badge from "./badge.json"; -import primarySecondary from "./primary-secondary.json"; +import { createTemplate } from "@/lib/utils"; -export const linksListTemplates = [ - createTemplate({ - json: badge, - title: "Badge link style", - description: "wdwefewfwefwef", - category: "linksList", - }), +import defaultPreview from "./default-preview.png"; +import defaultTemplate from "./default.json"; + +export const linksListTemplates: Preset[] = [ createTemplate({ - json: primarySecondary, - title: "Primary and secondary links list", - description: "wdwefewf121212wefwef", + title: "Two links list", + json: defaultTemplate, category: "linksList", + screenshot: defaultPreview.src, }), ]; diff --git a/apps/sanity/src/contentSections/LinksList/templates/primary-secondary.json b/apps/sanity/src/contentSections/LinksList/templates/primary-secondary.json deleted file mode 100644 index d7a2158..0000000 --- a/apps/sanity/src/contentSections/LinksList/templates/primary-secondary.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "_type": "section.linksList", - "alignVariant": "center", - "links": [ - { - "_type": "customLink", - "target": "_self", - "text": "Get Started", - "type": "internal", - "url": { - "_ref": "0a28744d-602b-49a3-b91a-17a56e3c7832", - "_type": "reference" - }, - "variant": "primary" - }, - { - "_type": "customLink", - "target": "_self", - "text": "Try Now", - "type": "internal", - "url": { - "_ref": "0a28744d-602b-49a3-b91a-17a56e3c7832", - "_type": "reference" - }, - "variant": "secondary" - } - ], - "theme": "dark" -} diff --git a/apps/sanity/src/contentSections/Logos/templates/default-preview.png b/apps/sanity/src/contentSections/Logos/templates/default-preview.png new file mode 100644 index 0000000..9732e4e Binary files /dev/null and b/apps/sanity/src/contentSections/Logos/templates/default-preview.png differ diff --git a/apps/sanity/src/contentSections/Logos/templates/logos.json b/apps/sanity/src/contentSections/Logos/templates/default.json similarity index 51% rename from apps/sanity/src/contentSections/Logos/templates/logos.json rename to apps/sanity/src/contentSections/Logos/templates/default.json index cff21a9..ea95f92 100644 --- a/apps/sanity/src/contentSections/Logos/templates/logos.json +++ b/apps/sanity/src/contentSections/Logos/templates/default.json @@ -1,122 +1,146 @@ { + "maxWidth": "base", + "backgroundColor": "none", "_type": "section.logos", + "alignVariant": "center", + "marginBottom": "base", + "_key": "92db570ae9c5", "items": [ { - "_type": "logoItem", + "_key": "48f5d8c30794", + "type": "logo", "image": { - "_type": "customImage", "aspectRatio": "3/1", - "height": 100, + "height": 300, "image": { "_type": "image", "alt": "prismic", "asset": { - "_ref": "image-ea3ba2b076652df8c4cdff0fcbc222e1629398d8-1024x264-webp", - "_type": "reference" + "_type": "reference", + "_ref": "image-ea3ba2b076652df8c4cdff0fcbc222e1629398d8-1024x264-webp" } - } + }, + "_type": "customImage" }, + "_type": "logoItem", "link": { + "size": "base", "_type": "customLink", - "href": "https://github.com/dogfogfog", - "target": "_self", - "type": "url", - "variant": "primary" - }, - "type": "logoLink" + "variant": "default", + "text": "link text", + "type": "internal", + "target": "_self", + "url": null + } }, { "_type": "logoItem", + "link": { + "text": "link text", + "type": "internal", + "target": "_self", + "size": "base", + "_type": "customLink", + "variant": "default", + "url": null + }, + "_key": "09a3481afc801a6b1c7ba37c72d075f4", + "type": "logo", "image": { "_type": "customImage", - "aspectRatio": "4/1", + "aspectRatio": "3/1", "height": 300, "image": { - "_type": "image", - "alt": "gats", "asset": { "_ref": "image-ffa01b3e6b32fa47128b34c38d90363f9fdcbe21-2500x538-webp", "_type": "reference" - } + }, + "_type": "image", + "alt": "storyblok" } - }, - "link": { - "_type": "customLink", - "target": "_self", - "type": "internal", - "variant": "primary" - }, - "type": "logo" + } }, { - "_type": "logoItem", + "type": "logo", "image": { "_type": "customImage", "aspectRatio": "3/1", - "height": 200, + "height": 300, "image": { - "_type": "image", - "alt": "hygraph", "asset": { - "_ref": "image-6e6cc1187326add2d8ddc718895981e3376338cc-716x200-webp", - "_type": "reference" - } + "_type": "reference", + "_ref": "image-6e6cc1187326add2d8ddc718895981e3376338cc-716x200-webp" + }, + "_type": "image", + "alt": "hygraph" } }, + "_type": "logoItem", "link": { - "_type": "customLink", - "target": "_self", + "text": "link text", + "url": null, "type": "internal", - "variant": "primary" + "target": "_self", + "size": "base", + "_type": "customLink", + "variant": "default" }, - "type": "logo" + "_key": "2d441c5f50af821299e3c4d177b0bcb1" }, { "_type": "logoItem", + "link": { + "size": "base", + "_type": "customLink", + "url": null, + "variant": "default", + "text": "link text", + "type": "internal", + "target": "_self" + }, + "_key": "7cf2eb61d1ccb04c545eda2a7d8dfebd", + "type": "logo", "image": { "_type": "customImage", "aspectRatio": "3/1", - "height": 200, + "height": 300, "image": { "_type": "image", - "alt": "hygraph", + "alt": "ghost", "asset": { "_ref": "image-14480f7e6cffd126f29ca432552f310e8b01559c-800x294-webp", "_type": "reference" } } - }, - "link": { - "_type": "customLink", - "target": "_self", - "type": "internal", - "variant": "primary" - }, - "type": "logo" + } }, { - "_type": "logoItem", + "_key": "782a25eb852075058097ec214d1a2b8c", + "type": "logo", "image": { - "_type": "customImage", - "aspectRatio": "3/1", - "height": 200, "image": { "_type": "image", - "alt": "gats", + "alt": "gatsby", "asset": { "_ref": "image-d356e78adf7bb1d8b313aedd75de21701a915eeb-2000x555-webp", "_type": "reference" } - } + }, + "_type": "customImage", + "aspectRatio": "3/1", + "height": 300 }, + "_type": "logoItem", "link": { + "target": "_self", + "size": "base", + "url": null, "_type": "customLink", - "target": "_self", - "type": "internal", - "variant": "primary" - }, - "type": "logo" + "variant": "default", + "text": "link text", + "type": "internal" + } } ], - "variant": "center" + "marginTop": "base" } diff --git a/apps/sanity/src/contentSections/Logos/templates/index.ts b/apps/sanity/src/contentSections/Logos/templates/index.ts index d9bfe1e..3165056 100644 --- a/apps/sanity/src/contentSections/Logos/templates/index.ts +++ b/apps/sanity/src/contentSections/Logos/templates/index.ts @@ -1,12 +1,15 @@ -import { createTemplate } from "@/lib/templateSelectorInput/createTemplate"; +import type { Preset } from "@focus-reactive/sanity-plugin-cms-kit"; -import logos from "./logos.json"; +import { createTemplate } from "@/lib/utils"; -export const logosTemplates = [ +import defaultPreview from "./default-preview.png"; +import defaultTemplate from "./default.json"; + +export const logosTemplates: Preset[] = [ createTemplate({ - json: logos, - title: "Logos list", - description: "wdwefewfwefwef", + title: "1212121212 Logos default", + json: defaultTemplate, category: "logos", + screenshot: defaultPreview.src, }), ]; diff --git a/apps/sanity/src/contentSections/presets.ts b/apps/sanity/src/contentSections/presets.ts index e7fe3f2..6055c39 100644 --- a/apps/sanity/src/contentSections/presets.ts +++ b/apps/sanity/src/contentSections/presets.ts @@ -1,13 +1,15 @@ import { blogTemplates } from "./Blog/templates"; import { cardsGridsTemplates } from "./CardsGrid/templates"; import { copyTemplates } from "./Copy/templates"; +import { heroTemplates } from "./Hero/templates"; import { linksListTemplates } from "./LinksList/templates"; import { logosTemplates } from "./Logos/templates"; export const sectionsPresets = { + logos: logosTemplates, blog: blogTemplates, cardsGrids: cardsGridsTemplates, copy: copyTemplates, linksList: linksListTemplates, - logos: logosTemplates, + hero: heroTemplates, }; diff --git a/apps/sanity/src/lib/schemas/customRichText.tsx b/apps/sanity/src/lib/schemas/customRichText.tsx index 6af3b04..58481b0 100644 --- a/apps/sanity/src/lib/schemas/customRichText.tsx +++ b/apps/sanity/src/lib/schemas/customRichText.tsx @@ -1,10 +1,8 @@ import { CommonGroup, commonGroups } from "@/contentSections/commonFields"; -import { sectionsPresets } from "@/contentSections/presets"; +// import { sectionsPresets } from "@/contentSections/presets"; import { AlignVariant } from "@shared/ui/components/ui/richText/types"; import { defineField, defineType } from "sanity"; -import { componentsWithBlocksInput } from "@/lib/templateSelectorInput"; - export const richTextBreak = defineType({ name: "break", type: "object", @@ -69,18 +67,18 @@ const customRichText = defineType({ type: "section.linksList", }, ], - components: componentsWithBlocksInput({ - presets: Object.values(sectionsPresets) - .flat() - .filter((v) => - [ - "section.logos", - "section.cardsGrid", - "section.linksList", - ].includes(v.value._type), - ), - isRichText: true, - }), + // components: componentsWithBlocksInput({ + // presets: Object.values(sectionsPresets) + // .flat() + // .filter((v) => + // [ + // "section.logos", + // "section.cardsGrid", + // "section.linksList", + // ].includes(v.value._type), + // ), + // isRichText: true, + // }), }), defineField({ diff --git a/apps/sanity/src/lib/templateSelectorInput/BlocksBrowser.tsx b/apps/sanity/src/lib/templateSelectorInput/BlocksBrowser.tsx deleted file mode 100644 index a6907a1..0000000 --- a/apps/sanity/src/lib/templateSelectorInput/BlocksBrowser.tsx +++ /dev/null @@ -1,371 +0,0 @@ -import { useState } from "react"; -import { CloseCircleIcon, SearchIcon } from "@sanity/icons"; -import { Autocomplete, Box, Select, Stack } from "@sanity/ui"; -import styled from "styled-components"; - -import type { - OnItemAppend, - Preset, - RenderItemProps, - RenderItemViewProps, - RenderViewProps, -} from "./types"; - -const DefaultRenderItemView = ({ preset }: RenderItemViewProps) => { - const height = 100 + Math.round(Math.random() * 300); - - return ( -
{preset.name}
-