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

47 lines
1.4 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-11-22 09:00:23 +00:00
tabItemClick: PropTypes.func.isRequired,
2018-10-16 10:19:51 +00:00
};
2018-09-21 06:16:15 +00:00
class DraftsView extends React.Component {
2018-09-15 08:14:17 +00:00
2018-10-15 07:51:29 +00:00
tabItemClick = (param) => {
2018-11-22 09:00:23 +00:00
this.props.tabItemClick(param);
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">
2018-11-22 09:00:23 +00:00
<li className={`tab ${this.props.currentTab === 'drafts' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('drafts')}>
<Link className='a' to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
2018-10-15 07:51:29 +00:00
{gettext('Drafts')}
</Link>
</li>
2018-11-22 09:00:23 +00:00
<li className={`tab ${this.props.currentTab === 'reviews' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('reviews')}>
<Link className='a' to={siteRoot + 'drafts/reviews/'} title={gettext('reviews')}>
2018-10-15 07:51:29 +00:00
{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;