aboutsummaryrefslogtreecommitdiffstats
path: root/sanity/schemas
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2023-02-21 23:24:14 +0100
committerivarlovlie <git@ivarlovlie.no>2023-02-21 23:24:14 +0100
commit6cb399e7267ae78e3e498bdbf5f51678ffb2cd45 (patch)
treeb109832a208927821fcfe65bd98ff9e3f391c44c /sanity/schemas
parent54bbc06bd84437c6b38e2f6c57060f21a8318720 (diff)
downloadauroraklinikken.no-6cb399e7267ae78e3e498bdbf5f51678ffb2cd45.tar.xz
auroraklinikken.no-6cb399e7267ae78e3e498bdbf5f51678ffb2cd45.zip
feat: Many things
Configure sanity in same project as the app Implement type safe sanity schema Read localised documents Strip down design
Diffstat (limited to 'sanity/schemas')
-rw-r--r--sanity/schemas/_locales.ts5
-rw-r--r--sanity/schemas/contact.ts35
-rw-r--r--sanity/schemas/description.ts21
-rw-r--r--sanity/schemas/hero.ts33
-rw-r--r--sanity/schemas/index.ts6
-rw-r--r--sanity/schemas/localized-string.ts20
6 files changed, 0 insertions, 120 deletions
diff --git a/sanity/schemas/_locales.ts b/sanity/schemas/_locales.ts
deleted file mode 100644
index 20273bd..0000000
--- a/sanity/schemas/_locales.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const supportedLanguages = [
- {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};
diff --git a/sanity/schemas/contact.ts b/sanity/schemas/contact.ts
deleted file mode 100644
index 1543e07..0000000
--- a/sanity/schemas/contact.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import {baseLanguage} from "./_locales";
-
-export default {
- name: "contact",
- type: "document",
- title: "Contact section",
- preview: {
- select: {
- title: `title.${baseLanguage.id}`,
- },
- },
- fields: [
- {
- title: "Address lines",
- name: "addressLines",
- type: "array",
- of: [{type: "localizedString"}],
- },
- {
- title: "Email",
- name: "email",
- type: "string",
- },
- {
- title: "Phone",
- name: "phone",
- type: "string",
- },
- {
- title: "Phone hours",
- name: "phoneHours",
- type: "localizedString",
- },
- ],
-};
diff --git a/sanity/schemas/description.ts b/sanity/schemas/description.ts
deleted file mode 100644
index f3fac23..0000000
--- a/sanity/schemas/description.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import {defineType} from "sanity";
-
-export default defineType({
- name: "description",
- type: "document",
- title: "Description section",
- i18n: true,
- fields: [
- {
- title: "Title",
- name: "title",
- type: "string",
- },
- {
- title: "Content",
- name: "content",
- type: "array",
- of: [{type: "block"}],
- },
- ],
-});
diff --git a/sanity/schemas/hero.ts b/sanity/schemas/hero.ts
deleted file mode 100644
index 30abd1c..0000000
--- a/sanity/schemas/hero.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import {defineType} from "sanity";
-
-export default defineType({
- name: "hero",
- type: "document",
- title: "Hero section",
- i18n: true,
- fields: [
- {
- title: "Title",
- name: "title",
- type: "string",
- },
- {
- title: "Content",
- name: "content",
- type: "array",
- of: [{type: "block"}],
- },
- {
- title: "Image",
- name: "image",
- type: "image",
- fields: [
- {
- title: "Alternative text",
- name: "alt",
- type: "string",
- },
- ],
- },
- ],
-});
diff --git a/sanity/schemas/index.ts b/sanity/schemas/index.ts
deleted file mode 100644
index 76072e5..0000000
--- a/sanity/schemas/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import contact from "./contact";
-import description from "./description";
-import hero from "./hero";
-import localizedString from "./localized-string";
-
-export const schemaTypes = [contact, localizedString, description, hero];
diff --git a/sanity/schemas/localized-string.ts b/sanity/schemas/localized-string.ts
deleted file mode 100644
index e4bcff6..0000000
--- a/sanity/schemas/localized-string.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import {supportedLanguages} from "./_locales";
-
-export default {
- title: "Localized string",
- name: "localizedString",
- type: "object",
- fieldsets: [
- {
- title: "Translations",
- name: "translations",
- options: {collapsible: true},
- },
- ],
- fields: supportedLanguages.map((lang) => ({
- title: lang.title,
- name: lang.id,
- type: "string",
- fieldset: lang.isDefault ? null : "translations",
- })),
-};