function createDocsPage(stories, projectType) {
  /** @type {Record<string, string>} */
  const storyNameToKey = {};

  if (stories) {
    for (const { key, name } of stories) {
      storyNameToKey[name || key] = key;
    }
  }

  return `import { React, mdx } from '@web/storybook-prebuilt/${projectType}.js';
import { AddContext } from '@web/storybook-prebuilt/addon-docs/blocks.js';

// Setup docs page
const mdxStoryNameToKey = ${JSON.stringify(storyNameToKey)};
__export_default__.parameters = __export_default__.parameters || {};
__export_default__.parameters.docs = __export_default__.parameters.docs || {};
__export_default__.parameters.docs.page = () => <AddContext
  mdxStoryNameToKey={mdxStoryNameToKey}
  mdxComponentAnnotations={__export_default__}><MDXContent
/></AddContext>;
${
  !stories || stories.length === 0
    ? `
export const __page = () => {
  throw new Error("Docs-only story");
};
__page.parameters = {
    docsOnly: true
};
`
    : ''
}

export default __export_default__;`;
}
@param {Story[]} [stories]
@param {string} projectType