2018-09-04 09:16:50 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-09-18 02:11:37 +00:00
|
|
|
import { serviceUrl } from '../constants';
|
2018-09-04 09:16:50 +00:00
|
|
|
class TreeDirList extends React.Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
2018-09-19 01:57:17 +00:00
|
|
|
isMourseEnter: false,
|
|
|
|
highlight: '',
|
2018-09-04 09:16:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-19 01:57:17 +00:00
|
|
|
onMouseEnter = () => {
|
|
|
|
this.setState({
|
|
|
|
highlight: 'tr-highlight'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onMouseLeave = () => {
|
|
|
|
this.setState({
|
|
|
|
highlight: '',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-09-04 09:16:50 +00:00
|
|
|
onMainNodeClick = () => {
|
|
|
|
this.props.onMainNodeClick(this.props.node);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let node = this.props.node;
|
|
|
|
return (
|
2018-09-19 01:57:17 +00:00
|
|
|
<tr className={this.state.highlight} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
|
|
|
<td className="icon" style={{width: "4%"}}>
|
2018-09-12 03:50:41 +00:00
|
|
|
<img src={node.type === "dir" ? serviceUrl + "/media/img/folder-192.png" : serviceUrl + "/media/img/file/192/txt.png"}></img>
|
2018-09-04 09:16:50 +00:00
|
|
|
</td>
|
2018-09-19 01:57:17 +00:00
|
|
|
<td className="name a-simulate" style={{width: "60%"}} onClick={this.onMainNodeClick}>{node.name}</td>
|
|
|
|
<td style={{width: "16%"}}>{node.size}</td>
|
2018-09-04 09:16:50 +00:00
|
|
|
<td style={{width: "20%"}} title={node.last_update_time}>{node.last_update_time}</td>
|
|
|
|
</tr>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-18 02:11:37 +00:00
|
|
|
export default TreeDirList;
|