generated from jetskis/superhi-site-build
-
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.
add reusable modules to the cms schema
- Loading branch information
1 parent
4d43c13
commit 6c55fa3
Showing
6 changed files
with
96 additions
and
0 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
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
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,19 @@ | ||
import React from 'react'; | ||
import Emoji from 'a11y-react-emoji'; | ||
|
||
const Icon = () => <Emoji style={{fontSize: '1.5em'}} symbol="🚧" />; | ||
|
||
export default { | ||
name: 'reusableComponentList', | ||
title: 'Components', | ||
icon: Icon, | ||
type: 'array', | ||
of: [ | ||
{ type: 'module.hero' }, | ||
{ type: 'module.valueProps' }, | ||
{ type: 'module.faqs' }, | ||
{ type: 'module.image' }, | ||
{ type: 'module.productGrid' }, | ||
{ type: 'module.standardText' }, | ||
], | ||
}; |
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,36 @@ | ||
import React from 'react'; | ||
import Emoji from 'a11y-react-emoji'; | ||
|
||
import { defineField } from 'sanity' | ||
|
||
const Icon = () => <Emoji style={{fontSize: '1.5em'}} symbol="♻️" />; | ||
|
||
export default { | ||
name: 'reusableModule', | ||
title: 'Reusable Module', | ||
icon: Icon, | ||
type: 'document', | ||
fields: [ | ||
{ | ||
name: 'title', | ||
title: 'Title', | ||
type: 'string', | ||
description: 'Only used internally in the CMS', | ||
validation: Rule => Rule.required(), | ||
}, | ||
defineField({ | ||
name: 'reusableComponentList', | ||
title: 'Modules', | ||
type: 'reusableComponentList', | ||
}), | ||
], | ||
preview: { | ||
select: { | ||
title: 'title', | ||
}, | ||
prepare: selection => ({ | ||
...selection, | ||
media: <Icon />, | ||
}), | ||
}, | ||
}; |
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,28 @@ | ||
import React from 'react' | ||
import {defineField, defineType} from 'sanity' | ||
import {PackageIcon} from '@sanity/icons' | ||
|
||
|
||
export default defineType({ | ||
name: 'module.reusableModule', | ||
title: 'Reusable Module', | ||
type: 'object', | ||
icon: PackageIcon, | ||
fields: [ | ||
|
||
defineField({ | ||
name: 'module', | ||
title: 'Reusable Module', | ||
type: 'reference', | ||
to: { type: 'reusableModule'}, | ||
}), | ||
], | ||
preview: { | ||
select: {}, | ||
prepare(selection) { | ||
return { | ||
title: 'Reusable Module', | ||
} | ||
}, | ||
}, | ||
}) |