{"size": 1003, "ext": "js", "max_stars_repo_path": "docs/src/pages/_DemoDescription.js", "max_stars_repo_name": "mccalluc/react-sandbox", "max_stars_repo_stars_event_min_datetime": "2019-07-12T13:44:17.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-21T20:28:34.000Z", "max_issues_repo_path": "docs/src/pages/_DemoDescription.js", "max_issues_repo_name": "biomage-ltd/vitessce", "max_issues_repo_issues_event_min_datetime": "2019-07-03T15:18:06.000Z", "max_issues_repo_issues_event_max_datetime": "2020-12-22T20:40:13.000Z", "max_forks_repo_path": "docs/src/pages/_DemoDescription.js", "max_forks_repo_name": "biomage-ltd/vitessce", "max_forks_repo_forks_event_min_datetime": "2019-09-10T18:20:26.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-22T21:42:57.000Z"}
{"max_stars_count": 28, "max_issues_count": 411, "max_forks_count": 4, "avg_line_length": 27.8611111111, "max_line_length": 133, "alphanum_fraction": 0.6719840479}
import React from 'react';
import Loading from '@theme/Loading';
import Loadable from 'react-loadable';
import registry from '@generated/registry';

function DemoDescription(props) {
  const { demo } = props;


  // Try to get the Description component from the markdown file in
  // the docs/demos/ directory (if one exists).
  // Adapted from https://github.com/facebook/docusaurus/blob/cf97662/packages/docusaurus/src/client/exports/ComponentCreator.tsx#L56
  const chunkRegistry = registry ? (
    Object.values(registry)
      .find(c => c[1] === `@site/docs/demos/${demo}.md`)
  ) : null;

  let Description = () => null;
  if (chunkRegistry) {
    const [optsLoader, optsModules, optsWebpack] = chunkRegistry;

    if (optsLoader && optsModules && optsWebpack) {
      Description = Loadable({
        loading: Loading,
        loader: optsLoader,
        modules: optsModules,
        webpack: () => optsWebpack,
      });
    }
  }

  return <Description />;
}

export default DemoDescription;
