@@ -15,13 +15,23 @@ import React, {Component} from 'react';
1515import TitleAndMetaTags from 'components/TitleAndMetaTags' ;
1616import { colors , media , sharedStyles } from 'theme' ;
1717import createOgUrl from 'utils/createOgUrl' ;
18+ import loadScript from 'utils/loadScript' ;
19+ import { babelURL } from 'site-constants' ;
20+ import ReactDOM from 'react-dom' ;
1821
1922class Home extends Component {
2023 componentDidMount ( ) {
21- mountCodeExample ( 'helloExample' , HELLO_COMPONENT ) ;
22- mountCodeExample ( 'timerExample' , TIMER_COMPONENT ) ;
23- mountCodeExample ( 'todoExample' , TODO_COMPONENT ) ;
24- mountCodeExample ( 'markdownExample' , MARKDOWN_COMPONENT ) ;
24+ renderExamplePlaceholder ( 'helloExample' ) ;
25+ renderExamplePlaceholder ( 'timerExample' ) ;
26+ renderExamplePlaceholder ( 'todoExample' ) ;
27+ renderExamplePlaceholder ( 'markdownExample' ) ;
28+
29+ loadScript ( babelURL ) . then ( ( ) => {
30+ mountCodeExample ( 'helloExample' , HELLO_COMPONENT ) ;
31+ mountCodeExample ( 'timerExample' , TIMER_COMPONENT ) ;
32+ mountCodeExample ( 'todoExample' , TODO_COMPONENT ) ;
33+ mountCodeExample ( 'markdownExample' , MARKDOWN_COMPONENT ) ;
34+ } ) ;
2535 }
2636
2737 render ( ) {
@@ -163,6 +173,16 @@ Home.propTypes = {
163173 location : PropTypes . object . isRequired ,
164174} ;
165175
176+ // TODO Improve this temporarily placeholder as part of
177+ // converting the home page from markdown template to a Gatsby
178+ // page (see issue #2)
179+ function renderExamplePlaceholder ( containerId ) {
180+ ReactDOM . render (
181+ < h4 > Loading code example...</ h4 > ,
182+ document . getElementById ( containerId ) ,
183+ ) ;
184+ }
185+
166186const CtaItem = ( { children, primary = false } ) => (
167187 < div
168188 css = { {
0 commit comments