Created
April 14, 2016 12:00
-
-
Save chrisui/7df5579bcff7a3a1692f89bf8425b074 to your computer and use it in GitHub Desktop.
Redocs Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global MATCH_COMPONENTS */ | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import 'styles/master.css'; | |
import Playground from 'redocs/lib/playground/components/playground'; | |
const reqCoreManifests = require.context('./core/components', true, MATCH_COMPONENTS); | |
const reqAthenaManifests = require.context('./athena/components', true, MATCH_COMPONENTS); | |
const reqHeraManifests = require.context('./hera/components', true, MATCH_COMPONENTS); | |
const reqHermesManifests = require.context('./hermes/components', true, MATCH_COMPONENTS); | |
const reqAphroditeManifests = require.context('./aphrodite/components', true, MATCH_COMPONENTS); | |
const manifestModules = [].concat( | |
reqCoreManifests.keys().map(reqCoreManifests), | |
reqAthenaManifests.keys().map(reqAthenaManifests), | |
reqHeraManifests.keys().map(reqHeraManifests), | |
reqHermesManifests.keys().map(reqHermesManifests), | |
reqAphroditeManifests.keys().map(reqAphroditeManifests), | |
); | |
const componentManifests = manifestModules | |
// normalise modules to just look at manifests | |
.map(module => module.default) | |
// ensure docs are parsed json | |
.map(manifest => ({...manifest, docs: JSON.parse(manifest.docs)})); | |
const playground = ( | |
<Playground manifests={componentManifests} /> | |
); | |
ReactDOM.render(playground, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment