Parcourir la source

Merge pull request #1363 from transloadit/feature/gdrive-thumbnails

Show thumbnails instead of a generic icon in Google Drive
Artur Paikin il y a 6 ans
Parent
commit
5a3f7c5161

+ 6 - 0
packages/@uppy/companion/src/server/provider/drive/adapter.js

@@ -22,6 +22,12 @@ exports.getItemIcon = (item) => {
   if (item.kind === 'drive#teamDrive') {
     return item.backgroundImageLink + '=w16-h16-n'
   }
+
+  if (item.thumbnailLink) {
+    const smallerThumbnailLink = item.thumbnailLink.replace('s220', 's40')
+    return smallerThumbnailLink
+  }
+
   return item.iconLink
 }
 

+ 3 - 2
packages/@uppy/provider-views/src/style.scss

@@ -267,8 +267,10 @@
 
   .uppy-ProviderBrowserItem-inner img,
   .uppy-ProviderBrowserItem-inner svg {
-    vertical-align: top;
+    vertical-align: middle;
     margin-right: 8px;
+    max-width: 20px;
+    max-height: 20px;
   }
 }
 
@@ -399,7 +401,6 @@
 .uppy-ProviderBrowserItem-checkbox {
   position: relative;
   display: inline-block;
-  top: -3px;
   margin-right: 15px;
 }