1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +00:00

Update published-repo and wechat-department catalogue style and interaction (#3912)

* change published-index-viewer btn

* change click same link node

* change weixin work department style

* change name
This commit is contained in:
Michael An
2019-07-25 12:00:24 +08:00
committed by Daniel Pan
parent 444903d2cc
commit 2fba71bf1e
4 changed files with 28 additions and 10 deletions

View File

@@ -78,13 +78,14 @@ class IndexContentViewer extends React.Component {
onLinkClick = (event) => {
event.preventDefault();
event.stopPropagation();
const link = this.getLink(event.target);
if (link) this.props.onLinkClick(link);
const currentPath = event.target.getAttribute('data-path');
if (currentPath) {
if (currentPath === this.state.currentPath) {
return;
} else if (currentPath) {
this.setState({ currentPath: currentPath });
}
const link = this.getLink(event.target);
if (link) this.props.onLinkClick(link);
}
getLink = (node) => {
@@ -248,12 +249,16 @@ class FolderItem extends React.Component {
});
}
expandChildNodes = () => {
this.setState({ expanded: true });
}
renderLink = (node) => {
const className = node.path === this.props.currentPath ? 'wiki-nav-content wiki-nav-content-highlight' : 'wiki-nav-content';
if (node.href && node.name) {
return <div className={className}><a href={node.href} data-path={node.path}>{node.name}</a></div>;
return <div className={className}><a href={node.href} data-path={node.path} onClick={this.expandChildNodes}>{node.name}</a></div>;
} else if (node.name) {
return <div className="wiki-nav-content"><span>{node.name}</span></div>;
return <div className="wiki-nav-content"><span onClick={this.expandChildNodes}>{node.name}</span></div>;
} else {
return null;
}