-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor & update schemas of
Sanity
CMS
- Loading branch information
Showing
2 changed files
with
43 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,53 @@ | ||
import {Rule, SchemaTypeDefinition} from 'sanity' | ||
|
||
const programs: SchemaTypeDefinition = { | ||
name: 'program', | ||
title: 'Program', | ||
name: 'programs', | ||
title: 'Программы', | ||
type: 'document', | ||
fields: [ | ||
{ | ||
name: 'name', | ||
title: 'Program Name', | ||
title: 'Название программы', | ||
type: 'string', | ||
validation: (rule: Rule) => rule.required(), | ||
}, | ||
{ | ||
name: 'duration', | ||
title: 'Program Duration', | ||
title: 'Длительность программы', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'description', | ||
title: 'Program Description', | ||
title: 'Описание программы', | ||
type: 'text', | ||
}, | ||
{ | ||
name: 'images', | ||
title: 'Program Images', | ||
title: 'Изображения', | ||
type: 'array', | ||
of: [{type: 'image'}], | ||
of: [{type: 'image', options: {hotspot: true}}], | ||
}, | ||
{ | ||
name: 'pdf', | ||
title: 'Program PDF', | ||
title: 'PDF файл', | ||
type: 'file', | ||
}, | ||
{ | ||
name: 'slug', | ||
title: 'Program Slug', | ||
title: 'Ссылка', | ||
type: 'slug', | ||
options: { | ||
source: 'name', | ||
}, | ||
validation: (rule: Rule) => rule.required(), | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: 'name', | ||
media: 'images.0.asset', | ||
}, | ||
}, | ||
} | ||
|
||
export default program | ||
export default programs |
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,17 +1,35 @@ | ||
import {SchemaEntityTypes} from './index' | ||
import {Rule, SchemaTypeDefinition} from 'sanity' | ||
|
||
const stocks: SchemaEntityTypes = { | ||
const stocks: SchemaTypeDefinition = { | ||
name: 'stocks', | ||
title: 'Stocks', | ||
title: 'Акции', | ||
type: 'document', | ||
fields: [ | ||
{ | ||
name: 'images', | ||
title: 'Stock Images', | ||
type: 'array', | ||
of: [{type: 'image'}], | ||
name: 'title', | ||
title: 'Заголовок', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'caption', | ||
title: 'Подпись', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'image', | ||
title: 'Stock Image', | ||
type: 'image', | ||
options: {hotspot: true}, | ||
validation: (rule: Rule) => rule.required(), | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: 'title', | ||
subtitle: 'caption', | ||
media: 'image', | ||
}, | ||
}, | ||
} | ||
|
||
export default stocks |