From 1726a81b320e92ce412c0fa2b2b05f73798cc4ee Mon Sep 17 00:00:00 2001
From: Jules Laplace <julescarbon@gmail.com>
Date: Thu, 29 Jun 2017 03:09:00 +0200
Subject: folder browser

---
 client/components/App.jsx | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'client/components/App.jsx')

diff --git a/client/components/App.jsx b/client/components/App.jsx
index bbb50d6..f7122b2 100644
--- a/client/components/App.jsx
+++ b/client/components/App.jsx
@@ -5,23 +5,38 @@ import { Link, withRouter } from 'react-router-dom'
 
 import Header from './Header.jsx'
 import Folders from './Folders/Folders.jsx'
+import Folder from './Folder/Folder.jsx'
+
+import client from '../client'
 
 class App extends Component {
   constructor(props) {
     super()
     this.state = {
       folders: null,
+      openFolders: [],
+    }
+    client.folder.index().then( folders => this.setState({ folders }) )
+  }
+  openFolder(folder) {
+    if (this.state.openFolders.indexOf(folder) === -1) {
+      this.setState({ openFolders: this.state.openFolders.concat([folder]) })
     }
   }
   render() {
+    const openFolders = this.state.openFolders.map((folder) => {
+      return (
+        <Folder folder={folder} />
+      )
+    })
     return (
       <div>
         <Header />
-        <Folders />
+        <Folders folders={this.state.folders} openFolder={(folder) => this.openFolder(folder)} />
+        {openFolders}
       </div>
     )
   }
 }
 
 export default withRouter(App)
-
-- 
cgit v1.2.3-70-g09d2

