Skip to content

Commit

Permalink
[design-studio] Add more examples of complex "array of options"
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 1a31c69 commit b5fd8bc
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion packages/design-studio/schemas/allInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const title = {
const arrayListOfOptionsExample = {
type: 'array',
name: 'arrayListOfOptionsExample',
title: 'Array (1)',
title: 'Array (1a)',
description: 'List of options',
of: [
{
Expand All @@ -27,6 +27,48 @@ const arrayListOfOptionsExample = {
}
}

const arrayListOfObjectOptionsExample = {
type: 'array',
name: 'arrayListOfObjectOptionsExample',
title: 'Array (1b)',
description: 'List of options (objects)',
of: [
{
type: 'object',
fields: [
{name: 'bodyPart', type: 'string'},
{name: 'isInternal', type: 'boolean'}
]
}
],
options: {
list: [
{value: {bodyPart: 'Head', isInternal: false}, title: 'Head'},
{value: {bodyPart: 'Foot', isInternal: false}, title: 'Foot'},
{value: {bodyPart: 'Heart', isInternal: true}, title: 'Heart'}
]
}
}

const arrayListOfReferenceOptionsExample = {
type: 'array',
name: 'arrayListOfReferenceOptionsExample',
title: 'Array (1c)',
description: 'List of options (references)',
of: [
{
type: 'reference',
to: [{type: 'author'}]
}
],
options: {
list: [
{value: {_type: 'reference', _ref: 'marius'}, title: 'Marius'},
{value: {_type: 'reference', _ref: 'espen'}, title: 'Espen'}
]
}
}

const arrayOfObjectsExample = {
type: 'array',
name: 'arrayOfObjectsExample',
Expand Down Expand Up @@ -397,6 +439,8 @@ export default {

// array
arrayListOfOptionsExample,
arrayListOfObjectOptionsExample,
arrayListOfReferenceOptionsExample,
arrayOfObjectsExample,
arrayOfReferencesExample,
arrayOfStringsExample,
Expand Down

0 comments on commit b5fd8bc

Please sign in to comment.