import { fields } from '@keystatic/core';
import type { ContentComponent } from '@keystatic/core/content-components';
import { generalComponents } from '../components';

export const sharedComponents: Record<string, ContentComponent> =
  generalComponents;

export const createContentField = (
  additionalComponents?: Record<string, ContentComponent>,
) =>
  fields.markdoc({
    label: 'Body',
    options: {
      heading: [2, 3, 4, 5, 6],
    },
    components: {
      ...sharedComponents,
      ...additionalComponents,
    },
  });
