-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V3 add title to customer entry (#1004)
* Add title to customer case entry block * Add styling to title * Add translations to deliveries * Remove console log from the past
- Loading branch information
Showing
7 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
import { CaseIcon } from "@sanity/icons"; | ||
import { defineField } from "sanity"; | ||
|
||
import { isInternationalizedString } from "studio/lib/interfaces/global"; | ||
import { firstTranslation } from "studio/utils/i18n"; | ||
|
||
export const customerCasesEntry = defineField({ | ||
name: "customerCasesEntry", | ||
title: "Customer Cases Entry", | ||
type: "object", | ||
icon: CaseIcon, | ||
fields: [ | ||
{ | ||
name: "basicTitle", | ||
title: "Basic Title", | ||
type: "string", | ||
type: "internationalizedArrayString", | ||
description: | ||
"This will be the title of the customer cases entry section. Make it engaging to capture the attention of your audience.", | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: "basicTitle", | ||
}, | ||
prepare({ title }) { | ||
if (!isInternationalizedString(title)) { | ||
throw new TypeError( | ||
`Expected 'title' to be InternationalizedString, was ${typeof title}`, | ||
); | ||
} | ||
return { | ||
title: firstTranslation(title) ?? undefined, | ||
}; | ||
}, | ||
}, | ||
}); |