diff --git a/src/components/customerCases/customerCase/CustomerCase.tsx b/src/components/customerCases/customerCase/CustomerCase.tsx index 85b5a759d..98a6725f3 100644 --- a/src/components/customerCases/customerCase/CustomerCase.tsx +++ b/src/components/customerCases/customerCase/CustomerCase.tsx @@ -67,9 +67,16 @@ export default function CustomerCase({ customerCase }: CustomerCaseProps) {
{section._type === "richTextBlock" ? ( + ) : section._type === "quoteBlock" ? ( + section.quote && ( +
+ {section.quote} + {section.author && - {section.author}} +
+ ) ) : (
- {section.images.map((image) => ( + {section.images?.map((image) => (
{ + "quote": ${translatedFieldFragment("quote")}, + "author": ${translatedFieldFragment("author")}, + }, } } `; diff --git a/studioShared/schemas/documents/customerCase.ts b/studioShared/schemas/documents/customerCase.ts index 5e854614e..c211fffb4 100644 --- a/studioShared/schemas/documents/customerCase.ts +++ b/studioShared/schemas/documents/customerCase.ts @@ -8,6 +8,7 @@ import { firstTranslation } from "studio/utils/i18n"; import { customerCaseProjectInfo } from "studioShared/schemas/fields/customerCaseProjectInfo"; import imageBlock from "studioShared/schemas/objects/imageBlock"; import listBlock from "studioShared/schemas/objects/listBlock"; +import quoteBlock from "studioShared/schemas/objects/quoteBlock"; import richTextBlock from "studioShared/schemas/objects/richTextBlock"; export const customerCaseID = "customerCase"; @@ -49,7 +50,7 @@ const customerCase = defineType({ title: "Sections", description: "Add sections here", type: "array", - of: [richTextBlock, imageBlock, listBlock], + of: [richTextBlock, imageBlock, listBlock, quoteBlock], }), ], preview: { diff --git a/studioShared/schemas/objects/quoteBlock.ts b/studioShared/schemas/objects/quoteBlock.ts new file mode 100644 index 000000000..e7f52592d --- /dev/null +++ b/studioShared/schemas/objects/quoteBlock.ts @@ -0,0 +1,30 @@ +import { defineField } from "sanity"; + +import { firstTranslation } from "studio/utils/i18n"; + +const quoteBlock = defineField({ + name: "quoteBlock", + type: "object", + title: "Quote Block", + fields: [ + { + name: "quote", + type: "internationalizedArrayText", + title: "Quote", + }, + { + name: "author", + type: "internationalizedArrayString", + title: "Author of the quote", + }, + ], + preview: { + select: { + title: "quote", + }, + prepare({ title }) { + return { title: firstTranslation(title) ?? undefined }; + }, + }, +}); +export default quoteBlock;