const React = require('react'); const NodesChart = require('../charts/nodes-chart'); const navbarHeight = 160; const marginTop = 0; const Nodes = React.createClass({ getInitialState: function() { return { width: window.innerWidth, height: window.innerHeight - navbarHeight - marginTop }; }, componentDidMount: function() { window.addEventListener('resize', this.handleResize); }, componentWillUnmount: function() { window.removeEventListener('resize', this.handleResize); }, render: function() { return ( ); }, handleResize: function() { this.setDimensions(); }, setDimensions: function() { const width = window.innerWidth; const height = window.innerHeight - navbarHeight - marginTop; this.setState({height, width}); } }); module.exports = Nodes;