diff --git a/packages/common-components/src/FileInput/FileInput.tsx b/packages/common-components/src/FileInput/FileInput.tsx index 782e351f92..105b3443c8 100644 --- a/packages/common-components/src/FileInput/FileInput.tsx +++ b/packages/common-components/src/FileInput/FileInput.tsx @@ -5,7 +5,8 @@ import clsx from "clsx" import { ITheme, makeStyles, createStyles } from "@chainsafe/common-theme" import { Button } from "../Button" import { Typography } from "../Typography" -import { PaperclipIcon, PlusIcon } from "../Icons" +import { PaperclipIcon, PlusIcon, CrossOutlinedIcon } from "../Icons" +import { ScrollbarWrapper } from "../ScrollbarWrapper" const useStyles = makeStyles(({ constants, palette, overrides }: ITheme) => createStyles({ @@ -60,6 +61,12 @@ const useStyles = makeStyles(({ constants, palette, overrides }: ITheme) => }, ...overrides?.FileInput?.item, }, + itemText: { + flex: "1 1 0", + }, + scrollbar: { + maxHeight: "80vh", + }, }), ) @@ -119,7 +126,7 @@ const FileInput: React.FC = ({ setErrors(errors.concat(fileDropRejectionErrors)) } }, - [], + [value], ) useEffect(() => { @@ -139,6 +146,12 @@ const FileInput: React.FC = ({ ...dropZoneProps, }) + const removeItem = (i: number) => { + const items = value.value as any[] + items.splice(i, 1) + helpers.setValue(items) + } + return (
@@ -150,19 +163,37 @@ const FileInput: React.FC = ({ ) : ( <> - Upload Files and Folders + Upload Files )}
) : (
-
    - {value.value.map((file: any, i: any) => ( -
  • - {file.name} - {file.size} + +
      + {value.value.map((file: any, i: any) => ( +
    • + + {file.name} + +
    • + ))} +
    • + + Click to upload more files
    • - ))} -
    +
+
) ) : ( diff --git a/packages/common-components/src/TextInput/FormikTextInput.tsx b/packages/common-components/src/TextInput/FormikTextInput.tsx index 870f30be75..0d096d5ef3 100644 --- a/packages/common-components/src/TextInput/FormikTextInput.tsx +++ b/packages/common-components/src/TextInput/FormikTextInput.tsx @@ -1,12 +1,9 @@ import React from "react" import { useField } from "formik" -import TextInput from "./TextInput" +import TextInput, { ITextInputProps } from "./TextInput" -export interface FormikTextInputProps { - className?: string - label?: string - placeholder?: string - disabled?: boolean +export interface FormikTextInputProps + extends Omit { name: string inputVariant?: "default" | "minimal" type?: "text" | "email" | "password" | "url" | "search" @@ -28,6 +25,7 @@ const FormikTextInput: React.FC = ({ disabled = false, autoFocus, captionMessage, + ...rest }: FormikTextInputProps) => { const [field, meta, helpers] = useField(name) return ( diff --git a/packages/common-components/src/TextInput/TextInput.tsx b/packages/common-components/src/TextInput/TextInput.tsx index dc2a40c119..10986d4773 100644 --- a/packages/common-components/src/TextInput/TextInput.tsx +++ b/packages/common-components/src/TextInput/TextInput.tsx @@ -378,7 +378,11 @@ const useStyles = makeStyles( export type InputState = "normal" | "warning" | "success" | "error" -export interface ITextInputProps { +export interface ITextInputProps + extends Omit< + React.HTMLProps, + "onChange" | "label" | "size" | "value" + > { className?: string label?: string labelClassName?: string diff --git a/packages/files-ui/src/App.tsx b/packages/files-ui/src/App.tsx index 8aec659829..93dccd85f4 100644 --- a/packages/files-ui/src/App.tsx +++ b/packages/files-ui/src/App.tsx @@ -83,11 +83,10 @@ const App: React.FC<{}> = () => { { walletName: "coinbase" }, { walletName: "trust", - preferred: true, rpcUrl: "https://mainnet.infura.io/v3/a7e16429d2254d488d396710084e2cd3", }, - { walletName: "metamask" }, + { walletName: "metamask", preferred: true }, { walletName: "dapper" }, { walletName: "opera" }, { walletName: "operaTouch" }, @@ -96,6 +95,7 @@ const App: React.FC<{}> = () => { { walletName: "walletConnect", infuraKey: "a7e16429d2254d488d396710084e2cd3", + preferred: true, }, ], }, diff --git a/yarn.lock b/yarn.lock index e244853503..49db26a222 100644 --- a/yarn.lock +++ b/yarn.lock @@ -77,7 +77,6 @@ gensync "^1.0.0-beta.1" json5 "^2.1.2" lodash "^4.17.19" - resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" @@ -3915,6 +3914,13 @@ "@types/history" "*" "@types/react" "*" +"@types/react-beforeunload@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/react-beforeunload/-/react-beforeunload-2.1.0.tgz#023db4bf117a23a8a5f8b28d276cf00324b8ec98" + integrity sha512-N/j7wOFQjrmYuIvemMOsI/NNjwErZGjF/4I1NG9VrF1bLqi11BMD/nqBBedIze2FbtddKHgWfQCue3yzCsQJdg== + dependencies: + "@types/react" "*" + "@types/react-blockies@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@types/react-blockies/-/react-blockies-1.4.0.tgz#2fbb4eadac49a69ac19aeb727e17b81443070343" @@ -15926,6 +15932,14 @@ react-app-polyfill@^1.0.6: regenerator-runtime "^0.13.3" whatwg-fetch "^3.0.0" +react-beforeunload@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/react-beforeunload/-/react-beforeunload-2.4.0.tgz#82752a0b0605285aeddc83c5c7998b7ddd67ed0a" + integrity sha512-62n4aInZeZ3uf4Gx1rKvUjv0OoIZpeGVgnHtuMLKxNbDZz+gpsC9VyW7uEPyLHPTWqbP2UebIZa1t0K/I6S9/Q== + dependencies: + prop-types "^15.7.2" + use-latest "^1.2.0" + react-blockies@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/react-blockies/-/react-blockies-1.4.1.tgz#d4f0faf95ac197213a297a370a4d7f77ea3d0b08" @@ -19035,6 +19049,13 @@ use-latest@^1.0.0: dependencies: use-isomorphic-layout-effect "^1.0.0" +use-latest@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-latest/-/use-latest-1.2.0.tgz#a44f6572b8288e0972ec411bdd0840ada366f232" + integrity sha512-d2TEuG6nSLKQLAfW3By8mKr8HurOlTkul0sOpxbClIv4SQ4iOd7BYr7VIzdbktUCnv7dua/60xzd8igMU6jmyw== + dependencies: + use-isomorphic-layout-effect "^1.0.0" + use-sidecar@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/use-sidecar/-/use-sidecar-1.0.3.tgz#17a4e567d4830c0c0ee100040e85a7fe68611e0f"