diff --git a/src/components/sections/image-split/ImageSplit.tsx b/src/components/sections/image-split/ImageSplit.tsx index 704bc1be2..c1f038b70 100644 --- a/src/components/sections/image-split/ImageSplit.tsx +++ b/src/components/sections/image-split/ImageSplit.tsx @@ -1,5 +1,3 @@ -import { PortableText, PortableTextReactComponents } from "@portabletext/react"; - import { SanityImage } from "src/components/image/SanityImage"; import LinkButton from "src/components/linkButton/LinkButton"; import Text from "src/components/text/Text"; @@ -12,10 +10,6 @@ interface ImageSplitProps { section: ImageSplitSection; } -const myPortableTextComponents: Partial = { - block: ({ children }) => {children}, -}; - const ImageSplitComponent = ({ section }: ImageSplitProps) => { const hasImage = section.imageExtended; const alignment = section.imageExtended?.imageAlignment; @@ -35,11 +29,8 @@ const ImageSplitComponent = ({ section }: ImageSplitProps) => { {section.basicTitle} - {section.richText && ( - + {section.description && ( + {section.description} )} {section.actions.length > 0 && ( diff --git a/studio/lib/interfaces/pages.ts b/studio/lib/interfaces/pages.ts index 76cce87af..5e65e52a6 100644 --- a/studio/lib/interfaces/pages.ts +++ b/studio/lib/interfaces/pages.ts @@ -73,7 +73,7 @@ export interface ImageSplitSection { _key: string; basicTitle: string; imageExtended: ImageExtendedProps; - richText?: PortableTextBlock[]; + description: string; actions: ILink[]; } diff --git a/studio/lib/queries/pages.ts b/studio/lib/queries/pages.ts index 84f006331..bd3cc2d17 100644 --- a/studio/lib/queries/pages.ts +++ b/studio/lib/queries/pages.ts @@ -29,6 +29,8 @@ const SECTIONS_FRAGMENT = groq` }, _type == "imageSplitSection" => { ..., + "basicTitle": ${translatedFieldFragment("basicTitle")}, + "description": ${translatedFieldFragment("description")}, actions[] { ..., ${TRANSLATED_LINK_FRAGMENT} diff --git a/studio/schemas/objects/sections/imagesplit.ts b/studio/schemas/objects/sections/imagesplit.ts index 7fdcd2324..26361b42a 100644 --- a/studio/schemas/objects/sections/imagesplit.ts +++ b/studio/schemas/objects/sections/imagesplit.ts @@ -1,8 +1,9 @@ import { defineField } from "sanity"; import { imageExtended } from "studio/schemas/fields/media"; -import { richText, title } from "studio/schemas/fields/text"; +import { titleID } from "studio/schemas/fields/text"; import { link } from "studio/schemas/objects/link"; +import { firstTranslation } from "studio/utils/i18n"; export const imageID = "imageSplitSection"; @@ -11,8 +12,22 @@ export const imageSplitSection = defineField({ title: "Image Split", type: "object", fields: [ - title, - richText, + { + name: titleID.basic, + type: "internationalizedArrayString", + title: "Title", + description: + "Enter the primary title that will be displayed at the top of the employees section.", + }, + + { + name: "description", + type: "internationalizedArrayString", + title: "Main content", + description: + "Enter the main content that will be displayed below the title.", + }, + imageExtended, { name: "actions", @@ -28,8 +43,7 @@ export const imageSplitSection = defineField({ prepare(selection) { const { title } = selection; return { - title: title, - subtitle: "Image", + title: firstTranslation(title) ?? undefined, }; }, },