diff --git a/dev/test-studio/schema/debug/comments.ts b/dev/test-studio/schema/debug/comments.ts index e4835d884ce3..bfac01f93126 100644 --- a/dev/test-studio/schema/debug/comments.ts +++ b/dev/test-studio/schema/debug/comments.ts @@ -1,5 +1,7 @@ import {defineType} from 'sanity' +const DESCRIPTION = 'Comments added to this field should be hidden when the toggle above is checked' + export const commentsDebug = defineType({ name: 'commentsDebug', type: 'document', @@ -11,36 +13,99 @@ export const commentsDebug = defineType({ title: 'String title', }, { - name: 'hideImageField', + name: 'hideFields', type: 'boolean', - title: 'Hide image field', + title: 'Hide fields', + }, + { + type: 'object', + name: 'object', + title: 'Object title', + fields: [ + { + type: 'string', + name: 'string', + title: 'String title', + hidden: ({document}) => Boolean(document?.hideFields), + description: DESCRIPTION, + }, + { + type: 'number', + name: 'number', + title: 'Number title', + }, + ], }, { name: 'image', type: 'image', title: 'Image title', - hidden: ({document}) => Boolean(document?.hideImageField), + hidden: ({document}) => Boolean(document?.hideFields), + description: DESCRIPTION, }, { type: 'array', name: 'arrayOfObjects', - title: 'Array of objects title', + title: 'Array 1', of: [ { - name: 'firstObject', + name: 'arrayObject', type: 'object', - title: 'First object title', + title: 'Array object 1', fields: [ { name: 'string', type: 'string', - title: 'String title', + title: 'String 1', }, { name: 'image', type: 'image', - title: 'Image title', - hidden: ({document}) => Boolean(document?.hideImageField), + title: 'Image 1', + hidden: ({document}) => { + return Boolean(document?.hideFields) + }, + description: DESCRIPTION, + }, + { + name: 'nestedArray', + type: 'array', + title: 'Array 2', + of: [ + { + name: 'nestedArrayObject1', + type: 'object', + title: 'Nested array object 1', + fields: [ + { + name: 'string', + type: 'string', + title: 'String 2.1', + }, + { + name: 'image', + type: 'image', + title: 'Image 2.1', + hidden: ({document}) => { + return Boolean(document?.hideFields) + }, + description: DESCRIPTION, + }, + ], + }, + { + type: 'object', + name: 'nestedArrayObject2', + title: 'Nested array object 2', + fields: [ + { + name: 'string', + type: 'string', + title: 'String 2.2', + }, + ], + }, + ], }, ], },