-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🏗️ AT-33(BE): Add schema types for all contents.
- Loading branch information
1 parent
fcc9f9c
commit f8df499
Showing
18 changed files
with
1,210 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {BsPersonWorkspace} from 'react-icons/bs' | ||
|
||
export default { | ||
name: 'author', | ||
title: 'Author', | ||
type: 'document', | ||
icon: BsPersonWorkspace, | ||
|
||
fields: [ | ||
{ | ||
name: 'name', | ||
title: 'Name', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'slug', | ||
title: 'Slug', | ||
type: 'slug', | ||
options: { | ||
source: 'name', | ||
maxLength: 96, | ||
}, | ||
}, | ||
{ | ||
name: 'image', | ||
title: 'Image', | ||
type: 'image', | ||
options: { | ||
hotspot: true, | ||
}, | ||
}, | ||
{ | ||
name: 'bio', | ||
title: 'Bio', | ||
type: 'array', | ||
of: [ | ||
{ | ||
title: 'Block', | ||
type: 'block', | ||
styles: [{title: 'Normal', value: 'normal'}], | ||
lists: [], | ||
}, | ||
], | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: 'name', | ||
media: 'image', | ||
}, | ||
}, | ||
} |
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,67 @@ | ||
import {defineType, defineArrayMember} from 'sanity' | ||
|
||
/** | ||
* This is the schema definition for the rich text fields used for | ||
* for this blog studio. When you import it in schemas.js it can be | ||
* reused in other parts of the studio with: | ||
* { | ||
* name: 'someName', | ||
* title: 'Some title', | ||
* type: 'blockContent' | ||
* } | ||
*/ | ||
export default defineType({ | ||
title: 'Block Content', | ||
name: 'blockContent', | ||
type: 'array', | ||
of: [ | ||
defineArrayMember({ | ||
title: 'Block', | ||
type: 'block', | ||
// Styles let you set what your user can mark up blocks with. These | ||
// correspond with HTML tags, but you can set any title or value | ||
// you want and decide how you want to deal with it where you want to | ||
// use your content. | ||
styles: [ | ||
{title: 'Normal', value: 'normal'}, | ||
{title: 'H1', value: 'h1'}, | ||
{title: 'H2', value: 'h2'}, | ||
{title: 'H3', value: 'h3'}, | ||
{title: 'H4', value: 'h4'}, | ||
{title: 'Quote', value: 'blockquote'}, | ||
], | ||
lists: [{title: 'Bullet', value: 'bullet'}], | ||
// Marks let you mark up inline text in the block editor. | ||
marks: { | ||
// Decorators usually describe a single property – e.g. a typographic | ||
// preference or highlighting by editors. | ||
decorators: [ | ||
{title: 'Strong', value: 'strong'}, | ||
{title: 'Emphasis', value: 'em'}, | ||
], | ||
// Annotations can be any object structure – e.g. a link or a footnote. | ||
annotations: [ | ||
{ | ||
title: 'URL', | ||
name: 'link', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
title: 'URL', | ||
name: 'href', | ||
type: 'url', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}), | ||
// You can add additional types here. Note that you can't use | ||
// primitive types such as 'string' and 'number' in the same array | ||
// as a block type. | ||
defineArrayMember({ | ||
type: 'image', | ||
options: {hotspot: true}, | ||
}), | ||
], | ||
}) |
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,24 @@ | ||
import {MdCategory} from 'react-icons/md' | ||
|
||
export default { | ||
name: 'category', | ||
title: 'Category', | ||
type: 'document', | ||
initialValue: {previewTitle: 'Get Involved Page'}, | ||
icon: MdCategory, | ||
|
||
fields: [ | ||
{ | ||
name: 'title', | ||
title: 'Title', | ||
type: 'string', | ||
options: { | ||
list: [ | ||
{title: 'News', value: 'news'}, | ||
{title: 'Story', value: 'story'}, | ||
{title: 'Interviews', value: 'interviews'}, | ||
], | ||
}, | ||
}, | ||
], | ||
} |
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,24 @@ | ||
import {FaFlag} from 'react-icons/fa' | ||
|
||
export default { | ||
name: 'countryFlag', | ||
title: 'Country Flag', | ||
type: 'document', | ||
icon: FaFlag, | ||
|
||
fields: [ | ||
{ | ||
name: 'nameOfCountry', | ||
title: 'Name Of Country', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'imageOfCountryFlag', | ||
title: 'Image Of Country Flag', | ||
type: 'image', | ||
options: { | ||
hotspot: true, | ||
}, | ||
}, | ||
], | ||
} |
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,30 @@ | ||
import {PiFlagBannerFill} from 'react-icons/pi' | ||
|
||
export default { | ||
name: 'heroSection', | ||
title: 'Hero Section', | ||
type: 'document', | ||
icon: PiFlagBannerFill, | ||
|
||
fields: [ | ||
{ | ||
name: 'backgroundImage', | ||
title: 'Background image', | ||
type: 'image', | ||
validation: (rule: {required: () => any}) => rule.required(), | ||
options: { | ||
hotspot: true, | ||
}, | ||
}, | ||
{ | ||
name: 'headingText', | ||
title: 'Heading text', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'smallText', | ||
title: 'Small text', | ||
type: '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import blockContent from './blockContent' | ||
import category from './category' | ||
import post from './post' | ||
import author from './author' | ||
import hero from './heroSection' | ||
import smallLargeHeading from './smallLargeHeading' | ||
|
||
// Schemas for The Tnidividual Pages | ||
import homePage from './pages/homePage' | ||
import visionAndTeamPage from './pages/visionAndTeamPage' | ||
import teamBio from './pages/teamBio' | ||
import activitiesPage from './pages/activitiesPage' | ||
import FAQPage from './pages/FAQPage' | ||
import getInvolvedPage from './pages/getInvolvedPage' | ||
import albumsPage from './pages/albumsPage' | ||
import yearlyAlbum from './pages/yearlyAlbum' | ||
import countryFlag from './countryFlag' | ||
import blogPage from './pages/blogPage' | ||
|
||
export const schemaTypes = [ | ||
post, | ||
author, | ||
category, | ||
blockContent, | ||
hero, | ||
smallLargeHeading, | ||
yearlyAlbum, | ||
countryFlag, | ||
teamBio, | ||
homePage, | ||
visionAndTeamPage, | ||
activitiesPage, | ||
getInvolvedPage, | ||
FAQPage, | ||
albumsPage, | ||
blogPage, | ||
] |
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,92 @@ | ||
import {FcFaq} from 'react-icons/fc' | ||
|
||
export default { | ||
name: 'FAQPage', | ||
title: 'FAQ Page', | ||
type: 'document', | ||
initialValue: {previewTitle: 'FAQ Page'}, | ||
icon: FcFaq, | ||
|
||
fields: [ | ||
/*------------------------- | ||
* Mandatory Fields | ||
*------------------------*/ | ||
{ | ||
name: 'PreviewTitle', | ||
title: 'preview Title', | ||
type: 'string', | ||
description: `Please enter a title for the document. | ||
This would be used for the preview header content found on the left hand side tab`, | ||
// hidden: true, | ||
validation: (rule: {required: () => any}) => rule.required(), | ||
}, | ||
{ | ||
name: 'language', | ||
title: 'Language', | ||
type: 'string', | ||
readOnly: true, | ||
}, | ||
|
||
/*------------------------- | ||
* Other Fields | ||
*------------------------*/ | ||
{ | ||
name: 'heroSection_Faq', | ||
title: 'HERO SECTION - FAQ', | ||
type: 'heroSection', | ||
}, | ||
{ | ||
name: 'questionAndAnswersSection', | ||
title: 'QUESTION AND ANSWERS SECTION', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'heading', | ||
title: 'Heading', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'qandAs', | ||
title: 'Q & As', | ||
type: 'array', | ||
of: [ | ||
{ | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'question', | ||
title: 'Question', | ||
type: 'text', | ||
}, | ||
{ | ||
name: 'answer', | ||
title: 'Answer', | ||
type: 'text', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
|
||
preview: { | ||
select: { | ||
previewTitle: 'previewTitle', | ||
language: 'language', | ||
}, | ||
prepare(selection: {previewTitle: string; language: string}) { | ||
const {previewTitle, language} = selection | ||
const LANGUAGES: {[key: string]: string} = { | ||
en: 'English', | ||
de: 'German', | ||
} | ||
return { | ||
...selection, | ||
title: previewTitle && language && `${previewTitle} - ${language.toUpperCase()}`, | ||
subtitle: language && `FAQ page translation for ${LANGUAGES[language]}`, | ||
} | ||
}, | ||
}, | ||
} |
Oops, something went wrong.