1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-05 19:26:30 +00:00
seahub/frontend/src/pages/drafts/drafts-view.js

55 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-09-15 08:14:17 +00:00
import React from 'react';
2018-10-16 10:19:51 +00:00
import PropTypes from 'prop-types';
2018-10-15 07:51:29 +00:00
import { siteRoot, gettext } from '../../utils/constants';
import { Link } from '@reach/router';
2018-09-15 08:14:17 +00:00
2018-10-16 10:19:51 +00:00
const propTypes = {
currentTab: PropTypes.string.isRequired,
children: PropTypes.oneOfType([
PropTypes.array,
PropTypes.object
]).isRequired,
};
2018-09-21 06:16:15 +00:00
class DraftsView extends React.Component {
2018-09-15 08:14:17 +00:00
constructor(props) {
super(props);
this.state = {
2018-10-15 07:51:29 +00:00
currentTab: this.props.currentTab
2018-09-15 08:14:17 +00:00
};
}
2018-10-15 07:51:29 +00:00
tabItemClick = (param) => {
2018-09-15 08:14:17 +00:00
this.setState({
2018-10-15 07:51:29 +00:00
currentTab: param
2018-10-16 10:19:51 +00:00
});
2018-09-15 08:14:17 +00:00
}
render() {
return (
2018-09-21 06:16:15 +00:00
<div className="cur-view-container">
2018-10-15 07:51:29 +00:00
<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')}>
{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')}>
{gettext('Reviews')}
</Link>
</li>
</ul>
2018-09-15 08:14:17 +00:00
</div>
2018-10-15 07:51:29 +00:00
{this.props.children}
2018-09-15 08:14:17 +00:00
</div>
);
}
}
2018-10-16 10:19:51 +00:00
DraftsView.propTypes = propTypes;
2018-10-15 07:51:29 +00:00
export default DraftsView;