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/Folder/Folder.jsx | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 client/components/Folder/Folder.jsx

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

diff --git a/client/components/Folder/Folder.jsx b/client/components/Folder/Folder.jsx
new file mode 100644
index 0000000..891451c
--- /dev/null
+++ b/client/components/Folder/Folder.jsx
@@ -0,0 +1,39 @@
+import { h, Component } from 'preact'
+import { Link } from 'react-router-dom'
+
+import Modal from '../Modal.jsx'
+
+import client from '../../client.js'
+
+export default class Folder extends Component {
+  constructor(props) {
+    super()
+    this.state = {
+      adding: false,
+    }
+  }
+  toggle(folder) {
+    folder.open = ! folder.open
+    if (folder.open && ! folder.files) {
+      client.files.index({ 'folder_id': folder.id }).then( files => {
+        this.props.openFolder(folder)
+      })
+    }
+  }
+  render() {
+    console.log(this.props)
+    const folders = (this.props.folders || []).map( (folder,i) => {
+      return (
+        <div key={i} onClick={() => this.toggle(folder)}>
+          {folder.name}
+        </div>
+      )
+    })
+    return (
+      <div class='folders'>
+        <b>{this.props.folder.name}</b> <button onClick={() => {}}>+ file</button>
+        {folders}
+      </div>
+    )
+  }
+}
-- 
cgit v1.2.3-70-g09d2

