Skip to content

Commit

Permalink
feat(customerCase): main image
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Oct 17, 2024
1 parent b1b0b16 commit 0136ae9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions studioShared/lib/queries/customerCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ export const CUSTOMER_CASES_QUERY = groq`
}
`;

const INTERNATIONALIZED_IMAGE_FRAGMENT = groq`
"alt": ${translatedFieldFragment("alt")},
"url": asset -> url
`;

export const CUSTOMER_CASE_QUERY = groq`
*[_type == "customerCase" && ${translatedFieldFragment("slug")} == $slug][0] {
${CUSTOMER_CASE_BASE_FRAGMENT},
"image": image {
${INTERNATIONALIZED_IMAGE_FRAGMENT}
},
"richText": ${translatedFieldFragment("richText")},
"projectInfo": projectInfo {
customer,
Expand All @@ -36,8 +44,7 @@ export const CUSTOMER_CASE_QUERY = groq`
},
_type == "imageBlock" => {
"images": images[] {
"alt": ${translatedFieldFragment("alt")},
"url": asset -> url
${INTERNATIONALIZED_IMAGE_FRAGMENT}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions studioShared/schemas/documents/customerCase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineField, defineType } from "sanity";

import { isInternationalizedString } from "studio/lib/interfaces/global";
import { internationalizedImage } from "studio/schemas/fields/media";
import { richTextID, titleID } from "studio/schemas/fields/text";
import { titleSlug } from "studio/schemas/schemaTypes/slug";
import { firstTranslation } from "studio/utils/i18n";
Expand Down Expand Up @@ -31,6 +32,11 @@ const customerCase = defineType({
description:
"Short paragraph displayed at the top of the customer case page",
}),
defineField({
...internationalizedImage,
title: "Main Image",
description: "Large image displayed at the top of the customer case page",
}),
defineField({
...customerCaseProjectInfo,
options: {
Expand Down

0 comments on commit 0136ae9

Please sign in to comment.