Browse Source

simplify placeholder

main
renanpvaz 8 years ago
parent
commit
ba6a786f4c
  1. 37
      src/templates/home.js

37
src/templates/home.js

@ -21,10 +21,10 @@ import ReactDOM from 'react-dom';
class Home extends Component { class Home extends Component {
componentDidMount() { componentDidMount() {
this.renderExamplePlaceholder('helloExample'); renderExamplePlaceholder('helloExample');
this.renderExamplePlaceholder('timerExample'); renderExamplePlaceholder('timerExample');
this.renderExamplePlaceholder('todoExample'); renderExamplePlaceholder('todoExample');
this.renderExamplePlaceholder('markdownExample'); renderExamplePlaceholder('markdownExample');
loadScript(babelURL).then(() => { loadScript(babelURL).then(() => {
mountCodeExample('helloExample', HELLO_COMPONENT); mountCodeExample('helloExample', HELLO_COMPONENT);
@ -34,25 +34,6 @@ class Home extends Component {
}); });
} }
renderExamplePlaceholder(containerId) {
ReactDOM.render(
<strong
css={{
transform: 'translate(65%, -5em)',
display: 'block',
[media.lessThan('xlarge')]: {
transform: 'none',
marginTop: 15,
textAlign: 'center',
},
}}>
Loading code example...
</strong>,
document.getElementById(containerId),
);
}
render() { render() {
const {data} = this.props; const {data} = this.props;
const title = 'React - A JavaScript library for building user interfaces'; const title = 'React - A JavaScript library for building user interfaces';
@ -192,6 +173,16 @@ Home.propTypes = {
location: PropTypes.object.isRequired, location: PropTypes.object.isRequired,
}; };
// TODO Improve this temporarily placeholder as part of
// converting the home page from markdown template to a Gatsby
// page (see issue #2)
function renderExamplePlaceholder(containerId) {
ReactDOM.render(
<h4>Loading code example...</h4>,
document.getElementById(containerId),
);
}
const CtaItem = ({children, primary = false}) => ( const CtaItem = ({children, primary = false}) => (
<div <div
css={{ css={{

Loading…
Cancel
Save