var React = require('react/addons') module.exports = React.createClass({ propTypes: { articles: React.PropTypes.arrayOf, currentArticle: React.PropTypes.shape({ id: React.PropTypes.number, type: React.PropTypes.string }) }, componentDidUpdate: function () { var index = this.props.articles.indexOf(this.props.currentArticle) var el = React.findDOMNode(this) var li = el.querySelectorAll('li')[index] var overflowBelow = el.clientHeight + el.scrollTop < li.offsetTop + li.clientHeight if (overflowBelow) { el.scrollTop = li.offsetTop + li.clientHeight - el.clientHeight } var overflowAbove = el.scrollTop > li.offsetTop if (overflowAbove) { el.scrollTop = li.offsetTop } }, render: function () { var list = this.props.articles.map(function (article) { if (article == null) { return (