-
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.
- Loading branch information
Showing
7 changed files
with
129 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export interface EmployeesPage { | ||
_createdAt: string; | ||
_id: string; | ||
_rev: string; | ||
_type: string; | ||
_updatedAt: string; | ||
language: string; | ||
basicTitle: string; | ||
slug: string; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { defineType } from "sanity"; | ||
|
||
import { isInternationalizedString } from "studio/lib/interfaces/global"; | ||
import { title, titleID } from "studio/schemas/fields/text"; | ||
import { titleSlug } from "studio/schemas/schemaTypes/slug"; | ||
import { firstTranslation } from "studio/utils/i18n"; | ||
|
||
export const employeesPageId = "employeesPage"; | ||
|
||
const employeesPage = defineType({ | ||
name: employeesPageId, | ||
type: "document", | ||
title: "Employees Page", | ||
fields: [ | ||
{ | ||
name: titleID.basic, | ||
type: "internationalizedArrayString", | ||
title: "Page Title", | ||
description: | ||
"Enter the primary title that will be displayed at the top of the employees page. This is what users will see when they visit the page.", | ||
}, | ||
{ | ||
...titleSlug, | ||
type: "internationalizedArrayString", | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: title.name, | ||
}, | ||
prepare({ title }) { | ||
if (!isInternationalizedString(title)) { | ||
throw new TypeError( | ||
`Expected 'title' to be InternationalizedString, was ${typeof title}`, | ||
); | ||
} | ||
return { | ||
title: firstTranslation(title) ?? undefined, | ||
}; | ||
}, | ||
}, | ||
}); | ||
|
||
export default employeesPage; |