Skip to content

Commit

Permalink
[design-studio] Add object examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Oct 6, 2020
1 parent d763499 commit a529b7b
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions packages/design-studio/schemas/allInputs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
const title = {
type: 'string',
name: 'title',
title: 'Title'
}

// example fields

const arrayOfObjects = {
type: 'array',
name: 'arrayOfObjects',
Expand Down Expand Up @@ -156,6 +164,32 @@ const numberRadioExample = {
}
}

const object = {
type: 'object',
name: 'object',
title: 'Object',
fields: [{type: 'string', name: 'title', title: 'Title'}]
}

const objectWithNestedValues = {
type: 'object',
name: 'objectWithNestedValues',
title: 'Object with nested values',
fields: [
{type: 'string', name: 'title', title: 'Title'},
{type: 'string', name: 'description', title: 'Description'},
{
type: 'object',
name: 'metadata',
title: 'Metadata',
fields: [
{type: 'string', name: 'title', title: 'Title'},
{type: 'string', name: 'description', title: 'Description'}
]
}
]
}

const portableText = {
type: 'array',
name: 'portableText',
Expand All @@ -175,7 +209,7 @@ const slugExample = {
name: 'slugExample',
title: 'Slug example',
options: {
source: 'stringExample',
source: 'title',
maxLength: 10
// slugify: () => ...
// isUnique: () => ...
Expand Down Expand Up @@ -230,8 +264,10 @@ export default {
title: 'All inputs',
fieldsets: [{name: 'dates', title: 'Date types'}],
fields: [
// @todo: array
// @todo: array[block[span]]
// metadata
title,

// array
arrayOfObjects,
arrayOfReferences,
arrayOfPrimitives,
Expand Down Expand Up @@ -263,7 +299,9 @@ export default {
numberDropdownExample,
numberRadioExample,

// @todo: object
// object
object,
objectWithNestedValues,

// portableText
portableText,
Expand Down

0 comments on commit a529b7b

Please sign in to comment.