-
-
Save danderson00/d67ca665a7eebe75653d1b552a1261e0 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 InputRange from 'react-input-range' | |
export default class Graph extends Component { | |
// set the default filter value - we are hard coding this range for simplicity | |
state = { | |
filter: { | |
min: new Date(2009, 7, 21).getTime(), | |
max: new Date(2014, 7, 21).getTime() | |
} | |
} | |
// ... | |
render = () => ( | |
<div> | |
<div className="filter"> | |
<InputRange | |
minValue={new Date(2009, 7, 21).getTime()} | |
maxValue={new Date(2014, 7, 21).getTime()} | |
value={this.state.filter} | |
step={86400000} // one day | |
onChange={filter => this.renderGraph(filter)} | |
formatLabel={value => new Date(value).toLocaleDateString()} /> | |
</div> | |
<div ref={element => this.element = element}></div> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment