import {richText} from './richText' import type {PreviewConfig, PreviewReturn} from '../types' export const contentGroup = ({ select = {}, prepare = (props = {}) => props, }: PreviewConfig = {}): PreviewReturn => ({ select: { label: 'label', heading: 'heading', content: 'content', link: 'link', ...select, }, prepare: ({heading, content, label = '', ...rest}) => { const subtitle = content ? richText(content) : '' return { title: heading || subtitle || label, subtitle: heading ? subtitle : label, ...prepare({heading, content, label, ...rest}), } }, })