Skip to content

Instantly share code, notes, and snippets.

@julesbou
Last active January 23, 2017 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesbou/670ff47d769630c9a60448ecf4ca66db to your computer and use it in GitHub Desktop.
Save julesbou/670ff47d769630c9a60448ecf4ca66db to your computer and use it in GitHub Desktop.
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)
<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>
<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>
<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