-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (48 loc) · 1.53 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<div id="root"></div>
<script src="index.js"></script>
<div id="root"></div>
<script>
import React, {Component} from 'react';
import ReactDOM from 'react-dom';Component
import FileTree from 'react-filetree-electron';
export default class extends Component {
constructor() {
super();
this.state = { files: this.props.files || [] };
}
componentDidMount() {
generateFileTreeObject(this.props.directory)
.then(files => {
this.setState({ files })
})
.catch(console.error)
}
render() {
const files = this.state.files;
return (
<ul>
{files && files.map(file => {
const filePath = file.filePath;
const fileName = filePath.split('/').slice(-1).join('');
return file.isFileBool ?
<li key={filePath + ' Directory'}>{`${fileName}`}
<FileTree directory={file.filePath} files={file.files} />}
</li>
:
<li key={filePath}>{`${fileName}`}</li>;
})
}
</ul>
)
}
}
</script>
</body>
</html>