Browse Source

GoogleDrive UI markup and some styling. New render method for UI.

Harry Hedger 9 years ago
parent
commit
7ffc0ee990
3 changed files with 89 additions and 1 deletions
  1. 38 1
      src/plugins/GoogleDrive.js
  2. 50 0
      src/scss/_googledrive.scss
  3. 1 0
      src/scss/uppy.scss

+ 38 - 1
src/plugins/GoogleDrive.js

@@ -220,6 +220,43 @@ export default class Google extends Plugin {
     `
     `
   }
   }
 
 
+  renderTemp (state) {
+    const breadcrumbs = state.directory.map((dir) => yo`<li><button onclick=${this.getSubFolder.bind(this, dir.id, dir.title)}>${dir.title}</button></li> `)
+    const folders = state.folders.map((folder) => yo`<tr ondblclick=${this.getSubFolder.bind(this, folder.id, folder.title)}><td>[Folder] - ${folder.title}</td><td>Me</td><td>${folder.modifiedByMeDate}</td><td>-</td></tr>`)
+    const files = state.files.map((file) => yo`<tr><td>[File] - ${file.title}</td><td>Me</td><td>${file.modifiedByMeDate}</td><td>-</td></tr>`)
+
+    return yo`
+      <div>
+        <ul class="UppyGoogleDrive-sidebar">
+          <li>My Drive</li>
+          <li>Shared with me</li>
+        </ul>
+        <div class="UppyGoogleDrive-header">
+          <ul class="UppyGoogleDrive-breadcrumbs">
+            ${breadcrumbs}
+          </ul>
+        </div>
+        <table class="UppyGoogleDrive-browser">
+          <thead>
+            <tr>
+              <td>Name</td>
+              <td>Owner</td>
+              <td>Last Modified</td>
+              <td>Filesize</td>
+            </tr>
+          </thead>
+          <tbody>
+            ${folders}
+            ${files}
+          </tbody>
+        </table>
+        <div class="UppyGoogleDrive-fileInfo">
+          File active
+        </div>
+      </div>
+    `
+  }
+
   renderError (err) {
   renderError (err) {
     return `Something went wrong.  Probably our fault. ${err}`
     return `Something went wrong.  Probably our fault. ${err}`
   }
   }
@@ -260,7 +297,7 @@ export default class Google extends Plugin {
 
 
   render (state) {
   render (state) {
     if (state.googleDrive.authenticated) {
     if (state.googleDrive.authenticated) {
-      return this.renderBrowser(state.googleDrive)
+      return this.renderTemp(state.googleDrive)
     } else {
     } else {
       return this.renderAuth()
       return this.renderAuth()
     }
     }

+ 50 - 0
src/scss/_googledrive.scss

@@ -0,0 +1,50 @@
+.UppyGoogleDrive-breadcrumbs {
+  list-style-type: none;
+  margin: 0;
+  padding: 0;
+}
+
+.UppyGoogleDrive-breadcrumbs li {
+  display: inline-block;
+}
+
+.UppyGoogleDrive-breadcrumbs li:after {
+  content: '>';
+}
+
+.UppyGoogleDrive-breadcrumbs li:last-child:after {
+  content: '';
+}
+
+.UppyGoogleDrive-sidebar {
+  background-color: #eee;
+  float: left;
+  height: 100%;
+  list-style-type: none;
+  margin: 0;
+  padding: 0;
+  width: 200px;
+}
+
+.UppyGoogleDrive-sidebar li {
+  margin: 0 auto;
+  padding: 0 32px;
+}
+
+.UppyGoogleDrive-browser {
+  border: 1px solid #eee;
+  border-collapse: collapse;
+  float: left;
+}
+
+.UppyGoogleDrive-browser td {
+  border-bottom: 1px solid #eee;
+  padding: 8px;
+}
+
+.UppyGoogleDrive-browser thead td {
+  background-color: #eee;
+}
+.UppyGoogleDrive-browser tbody tr:last-child td {
+  border-bottom: 0;
+}

+ 1 - 0
src/scss/uppy.scss

@@ -5,6 +5,7 @@
 @import '_variables.scss';
 @import '_variables.scss';
 @import '_utils.scss';
 @import '_utils.scss';
 @import '_dragdrop.scss';
 @import '_dragdrop.scss';
+@import '_googledrive.scss';
 @import '_progressbar.scss';
 @import '_progressbar.scss';
 @import '_progressdrawer.scss';
 @import '_progressdrawer.scss';
 @import '_spinner.scss';
 @import '_spinner.scss';