// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. var utils = require('../utils/utils.jsx'); export default class SettingsSidebar extends React.Component { componentDidUpdate() { $('.settings-modal').find('.modal-body').scrollTop(0); $('.settings-modal').find('.modal-body').perfectScrollbar('update'); } constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(tab, e) { e.preventDefault(); this.props.updateTab(tab.name); $(e.target).closest('.settings-modal').addClass('display--content'); } render() { let tabList = this.props.tabs.map(function makeTab(tab) { let key = `${tab.name}_li`; let className = ''; if (this.props.activeTab === tab.name) { className = 'active'; } return (
  • {tab.uiName}
  • ); }.bind(this)); return (
    ); } } SettingsSidebar.propTypes = { tabs: React.PropTypes.arrayOf(React.PropTypes.shape({ name: React.PropTypes.string.isRequired, uiName: React.PropTypes.string.isRequired, icon: React.PropTypes.string.isRequired })).isRequired, activeTab: React.PropTypes.string, updateTab: React.PropTypes.func.isRequired };