var React = require('react'), Header = require('./components/Header'), Footer = require('./components/Footer'), Loader = require('./components/Loader'), Logo = require('./components/Logo'), json = require('../logos.json'); var App = React.createClass({ getInitialState () { return { logos: json.items, columns: 3 }; }, componentDidMount: function () { this .getDOMNode() .offsetParent .addEventListener('keypress', function (e) { var intKey = (window.Event) ? e.which : e.keyCode; if (intKey === 45 && this.state.columns > 1) { this._changeColumns(this.state.columns - 1); } else if ((intKey === 43 || intKey === 61) && this.state.columns < 5) { this._changeColumns(this.state.columns + 1); } }.bind(this)); }, _onClickChangeColumns (e) { e.preventDefault(); var el = e.currentTarget, col = +el.dataset.column; this._changeColumns(this.state.columns + col); }, _changeColumns(num) { this.setState({ columns: num }); }, render () { var state = this.state, logos = []; state.logos.forEach(function (d, i) { d.files.forEach(function (f, j) { logos.push(); }); }); return (
    {logos}
); } }); module.exports = App;