1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-21 11:27:18 +00:00

fix tab highlight (#2551)

This commit is contained in:
C_Q
2018-11-22 17:00:23 +08:00
committed by Daniel Pan
parent fb6c097028
commit 2cf8f1b46e
9 changed files with 79 additions and 62 deletions

View File

@@ -9,21 +9,13 @@ const propTypes = {
PropTypes.array,
PropTypes.object
]).isRequired,
tabItemClick: PropTypes.func.isRequired,
};
class DraftsView extends React.Component {
constructor(props) {
super(props);
this.state = {
currentTab: this.props.currentTab
};
}
tabItemClick = (param) => {
this.setState({
currentTab: param
});
this.props.tabItemClick(param);
}
render() {
@@ -31,13 +23,13 @@ class DraftsView extends React.Component {
<div className="cur-view-container">
<div className="cur-view-path">
<ul className="tab-tabs-nav">
<li className={`tab ${this.state.currentTab === 'drafts' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('drafts')}>
<Link className='a' to={siteRoot + 'drafts'} title={gettext('Drafts')}>
<li className={`tab ${this.props.currentTab === 'drafts' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('drafts')}>
<Link className='a' to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
{gettext('Drafts')}
</Link>
</li>
<li className={`tab ${this.state.currentTab === 'reviews' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('reviews')}>
<Link className='a' to={siteRoot + 'drafts/reviews'} title={gettext('reviews')}>
<li className={`tab ${this.props.currentTab === 'reviews' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('reviews')}>
<Link className='a' to={siteRoot + 'drafts/reviews/'} title={gettext('reviews')}>
{gettext('Reviews')}
</Link>
</li>