How to use the @sanity/base/initial-value-template-builder.template function in @sanity/base

To help you get started, we’ve selected a few @sanity/base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / test-studio / src / templates.js View on Github external
import T from '@sanity/base/initial-value-template-builder'

export default [
  ...T.defaults(),

  T.template({
    id: 'author-developer',
    title: 'Developer',
    description: `Selects the role "Developer" for you, so you don't have to`,
    schemaType: 'author',
    value: params => ({role: 'developer'})
  }),

  T.template({
    id: 'book-by-author',
    title: 'Book by author',
    description: 'Book by a specific author',
    schemaType: 'book',
    parameters: [{name: 'authorId', type: 'string'}],
    value: params => ({
      author: {_type: 'reference', _ref: params.authorId}
    })
  })
]