import React from 'react' import { Box, Card, Flex, Text } from '@sanity/ui' import startCase from 'lodash/startCase.js' import type { noteInputProps, NoteOptions } from './types' const NoteInput = ( props: noteInputProps & { ref?: React.Ref }, ): React.JSX.Element | null => { const { ref, ...args } = props const { title, description } = args.schemaType const options = args.schemaType.options as NoteOptions | undefined // get last item in args.path array const pathId = String(args.path[args.path.length - 1] ?? '') const displayTitle = startCase(pathId) === title ? null : title const Icon = options?.icon const tone = options?.tone ?? 'primary' // bail if nothing was set if (!displayTitle && !description) return null return ( {Icon && ( )} {displayTitle && ( {displayTitle} )} {description && ( {description} )} ) } NoteInput.displayName = 'NoteInput' export default NoteInput