From 82cf40b516b5ab11c34b3642a01603ec1b590c9f Mon Sep 17 00:00:00 2001
From: Jules Laplace <julescarbon@gmail.com>
Date: Thu, 29 Jun 2017 13:05:21 +0200
Subject: store open folders in localstorage

---
 client/components/Folder/Folder.jsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

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

diff --git a/client/components/Folder/Folder.jsx b/client/components/Folder/Folder.jsx
index e39b40d..20d3014 100644
--- a/client/components/Folder/Folder.jsx
+++ b/client/components/Folder/Folder.jsx
@@ -14,6 +14,9 @@ export default class Folder extends Component {
       files: props.folder.files || [],
     }
     this.addFiles = this.addFiles.bind(this)
+    if (! props.folder.files) {
+      client.file.index({ folder_id: props.folder.id }).then( files => this.setState({ files }) )
+    }
   }
   addFiles(newFiles) {
     console.log(newFiles)
@@ -27,14 +30,22 @@ export default class Folder extends Component {
       if (! file) return
       return (
         <div key={i}>
-          {file.name}
+          <span class='name'>{file.name}</span>
         </div>
       )
     })
     return (
       <div class='folders'>
-        <b>{this.props.folder.name}</b> <FileUploadButton folder={this.props.folder} addFiles={this.addFiles} />
-        {files}
+        <div class='heading'>
+          <b>{this.props.folder.name}</b>
+          <div class='buttons'>
+            <FileUploadButton folder={this.props.folder} addFiles={this.addFiles} />
+            <button onClick={this.props.onClose}>x</button>
+          </div>
+        </div>
+        <div class='list'>
+          {files}
+        </div>
       </div>
     )
   }
-- 
cgit v1.2.3-70-g09d2

