Browse Source

hide collections import data button

tumao 4 years ago
parent
commit
abe819297b

+ 5 - 0
client/src/components/uploader/Types.ts

@@ -0,0 +1,5 @@
+export interface UploaderProps {
+  label: string;
+  accept: string;
+  btnClass?: string;
+}

+ 30 - 0
client/src/components/uploader/Uploader.tsx

@@ -0,0 +1,30 @@
+import { makeStyles, Theme } from '@material-ui/core';
+import { FC, useRef } from 'react';
+import CustomButton from '../customButton/CustomButton';
+import { UploaderProps } from './Types';
+
+const getStyles = makeStyles((theme: Theme) => ({
+  btn: {},
+}));
+
+const Uploader: FC<UploaderProps> = ({ label, accept, btnClass = '' }) => {
+  const inputRef = useRef(null);
+  const classes = getStyles();
+
+  return (
+    <form>
+      <CustomButton variant="text" className={`${classes.btn} ${btnClass}`}>
+        {label}
+      </CustomButton>
+      <input
+        ref={inputRef}
+        id="fileId"
+        type="file"
+        accept={accept}
+        style={{ display: 'none' }}
+      />
+    </form>
+  );
+};
+
+export default Uploader;

+ 20 - 20
client/src/pages/collections/Collections.tsx

@@ -225,26 +225,26 @@ const Collections = () => {
       },
       icon: 'add',
     },
-    {
-      label: btnTrans('insert'),
-      onClick: () => {
-        setDialog({
-          open: true,
-          type: 'custom',
-          params: {
-            component: <InsertContainer />,
-          },
-        });
-      },
-      /**
-       * insert validation:
-       * 1. At least 1 available collection
-       * 2. selected collections quantity shouldn't over 1
-       */
-      disabled: () =>
-        collectionList.length === 0 || selectedCollections.length > 1,
-      icon: 'upload',
-    },
+    // {
+    //   label: btnTrans('insert'),
+    //   onClick: () => {
+    //     setDialog({
+    //       open: true,
+    //       type: 'custom',
+    //       params: {
+    //         component: <InsertContainer />,
+    //       },
+    //     });
+    //   },
+    //   /**
+    //    * insert validation:
+    //    * 1. At least 1 available collection
+    //    * 2. selected collections quantity shouldn't over 1
+    //    */
+    //   disabled: () =>
+    //     collectionList.length === 0 || selectedCollections.length > 1,
+    //   icon: 'upload',
+    // },
     {
       type: 'iconBtn',
       onClick: () => {