Skip to content

Commit

Permalink
feat(desk): add __experimental_formPreviewTitle to documents (#5452)
Browse files Browse the repository at this point in the history
* feat(desk): add __experimental_hide_form_title to documents

* feat(desk): rename __experimental_hide_form_title to __experimental_form_preview_title

* feat(desk): rename to __experimental_formPreviewTitle
  • Loading branch information
pedrobonamin authored Jan 9, 2024
1 parent 8ff0308 commit 90c24c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dev/test-studio/schema/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export default defineType({
name: 'playlist',
title: 'Playlist',
type: 'document',
// eslint-disable-next-line camelcase
__experimental_formPreviewTitle: false,
liveEdit: true,
fields: [
{
Expand Down
5 changes: 5 additions & 0 deletions packages/@sanity/types/src/schema/definition/type/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ export interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
__experimental_search?: {path: string; weight: number; mapWith?: string}[]
/** @alpha */
__experimental_omnisearch_visibility?: boolean
/**
* Determines whether the large preview title is displayed in the document pane form
* @alpha
* */
__experimental_formPreviewTitle?: boolean
}
3 changes: 2 additions & 1 deletion packages/@sanity/types/src/schema/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ export interface ObjectSchemaType extends BaseSchemaType {
__experimental_omnisearch_visibility?: boolean
/** @alpha */
__experimental_actions?: string[]

/** @alpha */
__experimental_formPreviewTitle?: boolean
/**
* @beta
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {SchemaType} from '@sanity/types'
import {ObjectSchemaType, SchemaType} from '@sanity/types'
import {Heading, Stack, Text} from '@sanity/ui'
import {useTranslation} from 'react-i18next'
import styled, {css} from 'styled-components'
import {structureLocaleNamespace} from '../../../../i18n'

interface DocumentHeaderProps {
documentId: string
schemaType: SchemaType
schemaType: ObjectSchemaType
title?: string
}

Expand Down Expand Up @@ -61,6 +61,10 @@ export const FormHeader = ({documentId, schemaType, title}: DocumentHeaderProps)
const isSingleton = documentId === schemaType.name
const {t} = useTranslation(structureLocaleNamespace)

if (schemaType.__experimental_formPreviewTitle === false) {
return null
}

return (
<TitleContainer marginBottom={6} space={4}>
{!isSingleton && (
Expand Down

2 comments on commit 90c24c8

@vercel
Copy link

@vercel vercel bot commented on 90c24c8 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 90c24c8 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio.sanity.build
test-studio-git-next.sanity.build

Please sign in to comment.