mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 23:48:47 +00:00
74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Outline as OutlineView } from '@seafile/seafile-editor';
|
|
import DetailListView from './detail-list-view';
|
|
|
|
import '../css/side-panel.css';
|
|
|
|
const propTypes = {
|
|
document: PropTypes.array,
|
|
fileInfo: PropTypes.object.isRequired,
|
|
fileTagList: PropTypes.array,
|
|
onFileTagChanged: PropTypes.func.isRequired,
|
|
participants: PropTypes.array,
|
|
onParticipantsChange: PropTypes.func.isRequired,
|
|
};
|
|
|
|
class SidePanel extends React.PureComponent {
|
|
|
|
state = {
|
|
navItem: 'outline'
|
|
};
|
|
|
|
onOutlineClick = (event) => {
|
|
event.preventDefault();
|
|
this.setState({navItem: 'outline'});
|
|
};
|
|
|
|
onDetailClick = (event) => {
|
|
event.preventDefault();
|
|
this.setState({navItem: 'detail'});
|
|
};
|
|
|
|
render() {
|
|
var outlineActive = '';
|
|
var detailList = '';
|
|
if (this.state.navItem === 'outline') {
|
|
outlineActive = 'active';
|
|
} else if (this.state.navItem === 'detail') {
|
|
detailList = 'active';
|
|
}
|
|
|
|
return (
|
|
<div className="side-panel d-flex flex-column">
|
|
<ul className="flex-shrink-0 nav justify-content-around bg-white">
|
|
<li className="nav-item">
|
|
<a className={'nav-link ' + outlineActive} href="" onClick={this.onOutlineClick}><i className="iconfont icon-list-ul"/></a>
|
|
</li>
|
|
<li className="nav-item">
|
|
<a className={'nav-link ' + detailList} href="" onClick={this.onDetailClick}><i className={'iconfont icon-info-circle'}/></a>
|
|
</li>
|
|
</ul>
|
|
<div className="side-panel-content flex-fill">
|
|
{this.state.navItem === 'outline' &&
|
|
<OutlineView document={this.props.document} />
|
|
}
|
|
{this.state.navItem === 'detail' &&
|
|
<DetailListView
|
|
fileInfo={this.props.fileInfo}
|
|
fileTagList={this.props.fileTagList}
|
|
onFileTagChanged={this.props.onFileTagChanged}
|
|
/>
|
|
}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
SidePanel.propTypes = propTypes;
|
|
|
|
export default SidePanel;
|