Last active
January 23, 2017 15:49
-
-
Save julesbou/670ff47d769630c9a60448ecf4ca66db to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import WorldPop from './components/WorldPop/WorldPop' | |
class App extends Component { | |
render() { | |
let $chart | |
switch (this.props.chart) { | |
case 'WorldPop': | |
$chart = <WorldPop /> | |
break | |
case 'YieldDeclineBars': | |
$chart = <YieldDeclineBars /> | |
break | |
case 'YieldDeclineLines': | |
$chart = <YieldDeclineLines /> | |
break | |
default: | |
throw new Error(`Unknown chart: ${this.props.chart}`) | |
} | |
return ( | |
<div className="App">{$chart}</div> | |
) | |
} | |
} | |
export default connect( | |
state => ({ | |
chart: state.chart, | |
}) | |
)(App) |
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
<Chart title="World population" subtitle="Regional and demographic breakdown 1985-2015"> | |
<div> | |
<h1>this is the header, here the code for the chart/graphic</h1> | |
</div> | |
<div> | |
<p>this is the footer, here the code for the year selector and everything else</p> | |
</div> | |
</Chart> |
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
<Chart title="World population" subtitle="Regional and demographic breakdown 1985-2015"> | |
<div> | |
<h1>this is the header, here the code for the chart/graphic</h1> | |
</div> | |
<div> | |
<p>this is the footer, here the code for the year selector and everything else</p> | |
</div> | |
</Chart> |
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
<Chart title="World population" subtitle="Regional and demographic breakdown 1985-2015"> | |
<div> | |
<h1>this is the header, here the code for the chart/graphic</h1> | |
</div> | |
<div> | |
<p>this is the footer, here the code for the year selector and everything else</p> | |
</div> | |
</Chart> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment