浏览代码

Only show the plus button if selected file count !== maxNumberOfFiles

Artur Paikin 6 年之前
父节点
当前提交
ac945e1460
共有 1 个文件被更改,包括 14 次插入9 次删除
  1. 14 9
      packages/@uppy/dashboard/src/components/PanelTopBar.js

+ 14 - 9
packages/@uppy/dashboard/src/components/PanelTopBar.js

@@ -7,6 +7,8 @@ function DashboardContentTitle (props) {
 }
 }
 
 
 function PanelTopBar (props) {
 function PanelTopBar (props) {
+  const notOverFileLimit = props.maxNumberOfFiles !== props.totalFileCount
+
   return (
   return (
     <div class="uppy-DashboardContent-bar">
     <div class="uppy-DashboardContent-bar">
       <button class="uppy-DashboardContent-back"
       <button class="uppy-DashboardContent-back"
@@ -15,15 +17,18 @@ function PanelTopBar (props) {
       <div class="uppy-DashboardContent-title" role="heading" aria-level="h1">
       <div class="uppy-DashboardContent-title" role="heading" aria-level="h1">
         <DashboardContentTitle {...props} />
         <DashboardContentTitle {...props} />
       </div>
       </div>
-      <button class="uppy-DashboardContent-addMore"
-        type="button"
-        aria-label={props.i18n('addMoreFiles')}
-        title={props.i18n('addMoreFiles')}
-        onclick={() => props.toggleAddFilesPanel(true)}>
-        <svg class="UppyIcon" width="15" height="15" viewBox="0 0 13 13" version="1.1" xmlns="http://www.w3.org/2000/svg">
-          <path d="M7,6 L13,6 L13,7 L7,7 L7,13 L6,13 L6,7 L0,7 L0,6 L6,6 L6,0 L7,0 L7,6 Z" />
-        </svg>
-      </button>
+      { notOverFileLimit &&
+        <button class="uppy-DashboardContent-addMore"
+          type="button"
+          aria-label={props.i18n('addMoreFiles')}
+          title={props.i18n('addMoreFiles')}
+          onclick={() => props.toggleAddFilesPanel(true)}>
+          <svg class="UppyIcon" width="15" height="15" viewBox="0 0 13 13" version="1.1" xmlns="http://www.w3.org/2000/svg">
+            <path d="M7,6 L13,6 L13,7 L7,7 L7,13 L6,13 L6,7 L0,7 L0,6 L6,6 L6,0 L7,0 L7,6 Z" />
+          </svg>
+        </button>
+      }
+
     </div>
     </div>
   )
   )
 }
 }