From 51c7e7605ad868a90f7cb025cbd32c3583a8d8bf Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Mon, 26 Aug 2019 14:28:54 -0700 Subject: [PATCH] [test-studio] Add example of deep pane using initial value template --- packages/test-studio/src/deskStructure.js | 15 +++++++++++++++ packages/test-studio/src/templates.js | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/test-studio/src/deskStructure.js b/packages/test-studio/src/deskStructure.js index 6da1ec268fc..d20db6d2075 100644 --- a/packages/test-studio/src/deskStructure.js +++ b/packages/test-studio/src/deskStructure.js @@ -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() diff --git a/packages/test-studio/src/templates.js b/packages/test-studio/src/templates.js index 4a9db99be30..bef235e19b0 100644 --- a/packages/test-studio/src/templates.js +++ b/packages/test-studio/src/templates.js @@ -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} + }) }) ]