generated from shiftwalk/shiftwalk-sanity-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsanity-structure.js
More file actions
49 lines (44 loc) · 1.53 KB
/
sanity-structure.js
File metadata and controls
49 lines (44 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import S from "@sanity/desk-tool/structure-builder";
import IframePreview from './preview/IFramePreview'
import {orderableDocumentListDeskItem} from '@sanity/orderable-document-list'
import {
FiHome,
FiCamera,
FiMail,
FiPenTool,
} from 'react-icons/fi'
import { getGlobalSlug, previewURL } from './utils/resolveProductionUrl'
export const getDefaultDocumentNode = ({ schemaType }) => S.document().views(getPreview(schemaType))
const getPreview = (schemaType) => {
const globalSlug = getGlobalSlug(schemaType)
if (globalSlug) {
return [
S.view.form(),
S.view
.component(IframePreview)
.title('Web preview')
.options({ previewURL, isMobile: false, globalSlug }),
S.view
.component(IframePreview)
.title('Mobile preview')
.options({ previewURL, isMobile: true, globalSlug })
]
}
return [S.view.form()]
}
export default () =>
S.list()
.title("Content")
.items([
S.listItem().title('Home').child(S.editor().id('home').schemaType('home').documentId('singleton-home').views(getPreview('home'))).icon(FiHome),
S.divider(),
orderableDocumentListDeskItem({
type: 'projects',
title: 'Projects',
icon: FiCamera
}),
S.divider(),
S.listItem().title('Press').child(S.documentTypeList('press').title('Press')).icon(FiPenTool),
S.divider(),
S.listItem().title('Contact').child(S.editor().id('contact').schemaType('contact').documentId('singleton-contact').views(getPreview('contact'))).icon(FiMail),
]);