aboutsummaryrefslogtreecommitdiffstats
path: root/sanity/schemas
diff options
context:
space:
mode:
Diffstat (limited to 'sanity/schemas')
-rw-r--r--sanity/schemas/_locales.ts4
-rw-r--r--sanity/schemas/description.ts21
-rw-r--r--sanity/schemas/hero.ts28
-rw-r--r--sanity/schemas/index.ts4
4 files changed, 31 insertions, 26 deletions
diff --git a/sanity/schemas/_locales.ts b/sanity/schemas/_locales.ts
index 5f19303..8baca54 100644
--- a/sanity/schemas/_locales.ts
+++ b/sanity/schemas/_locales.ts
@@ -1,5 +1,5 @@
export const supportedLanguages = [
- { id: 'en', title: 'English' },
- { id: 'nb', title: 'Norwegian', isDefault: true },
+ { id: 'en', iso: "en-GB", title: 'English' },
+ { id: 'nb', iso: "nb-NO", title: 'Norwegian', isDefault: true },
]
export const baseLanguage = supportedLanguages.find(l => l.isDefault) as { id: string, title: string }; \ No newline at end of file
diff --git a/sanity/schemas/description.ts b/sanity/schemas/description.ts
index 211aac3..d5d5ff3 100644
--- a/sanity/schemas/description.ts
+++ b/sanity/schemas/description.ts
@@ -1,14 +1,10 @@
-import { baseLanguage } from "./_locales";
+import { defineType } from "sanity";
-export default {
+export default defineType({
name: 'description',
type: 'document',
title: 'Description section',
- preview: {
- select: {
- title: `title.${baseLanguage.id}`
- }
- },
+ i18n: true,
fields: [
{
title: "Title",
@@ -16,9 +12,12 @@ export default {
type: 'string',
},
{
- title: "Text",
- name: "text",
- type: "string",
+ title: "Content",
+ name: "content",
+ type: "array",
+ of: [
+ { type: "block" }
+ ]
}
]
-} \ No newline at end of file
+}) \ No newline at end of file
diff --git a/sanity/schemas/hero.ts b/sanity/schemas/hero.ts
index 48e5c77..8534675 100644
--- a/sanity/schemas/hero.ts
+++ b/sanity/schemas/hero.ts
@@ -1,14 +1,10 @@
-import { baseLanguage } from "./_locales";
+import { defineType } from "sanity";
-export default {
+export default defineType({
name: 'hero',
type: 'document',
title: 'Hero section',
- preview: {
- select: {
- title: `title.${baseLanguage.id}`
- }
- },
+ i18n: true,
fields: [
{
title: "Title",
@@ -16,14 +12,22 @@ export default {
type: 'string',
},
{
- title: "Subtitle",
- name: "subtitle",
- type: "string",
+ title: "Content",
+ name: "content",
+ type: "array",
+ of: [{ type: "block" }]
},
{
title: "Image",
name: "image",
- type: "image"
+ type: "image",
+ fields: [
+ {
+ title: "Alternative text",
+ name: 'alt',
+ type: 'string',
+ }
+ ]
}
]
-} \ No newline at end of file
+}) \ No newline at end of file
diff --git a/sanity/schemas/index.ts b/sanity/schemas/index.ts
index 8b37e85..9dfc403 100644
--- a/sanity/schemas/index.ts
+++ b/sanity/schemas/index.ts
@@ -1,4 +1,6 @@
import contact from "./contact";
+import description from "./description";
+import hero from "./hero";
import localizedString from "./localized-string";
-export const schemaTypes = [contact, localizedString] \ No newline at end of file
+export const schemaTypes = [contact, localizedString, description, hero] \ No newline at end of file