Skip to content

Commit

Permalink
[test-studio] Add example of deep pane using initial value template
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 24, 2019
1 parent 078869b commit 51c7e76
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
15 changes: 15 additions & 0 deletions packages/test-studio/src/deskStructure.js
Expand Up @@ -106,6 +106,21 @@ export default () =>
])
),

S.listItem({
id: 'books-by-author',
title: 'Books by author',
schemaType: 'book',
child: () =>
S.documentTypeList('author').child(authorId =>
S.documentTypeList('book')
.title('Books by author')
.filter('_type == $type && author._ref == $authorId')
.params({type: 'book', authorId})
.child(S.editorWithInitialValueTemplate('book-by-author', {authorId}))
.canHandleIntent(S.documentTypeList('book').getCanHandleIntent())
)
}),

S.divider(),

...S.documentTypeListItems()
Expand Down
15 changes: 12 additions & 3 deletions packages/test-studio/src/templates.js
Expand Up @@ -8,8 +8,17 @@ export default [
title: 'Developer',
description: `Selects the role "Developer" for you, so you don't have to`,
schemaType: 'author',
value: {
role: 'developer'
}
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}
})
})
]

0 comments on commit 51c7e76

Please sign in to comment.