From adeddc79945d0d70ca154a7b7bd060730458ca4a Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 20 Aug 2021 19:24:05 +0200 Subject: [PATCH] added react icons --- package.json | 1 + src/components/CreateDirButton.tsx | 3 ++- src/components/DirectoryElement.tsx | 3 ++- src/components/FileBrowser.tsx | 32 ++++++++++++++++++----------- src/components/FileElement.tsx | 3 ++- src/components/FileUploadButton.tsx | 3 ++- yarn.lock | 10 ++++----- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 77dbd8e..9944703 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "react": "^17.0.2", "react-contexify": "^5.0.0", "react-dom": "^17.0.2", + "react-icons": "^4.2.0", "react-scripts": "4.0.3", "typescript": "^4.1.2", "web-vitals": "^1.0.1" diff --git a/src/components/CreateDirButton.tsx b/src/components/CreateDirButton.tsx index 7b49ea5..bf4f3c6 100644 --- a/src/components/CreateDirButton.tsx +++ b/src/components/CreateDirButton.tsx @@ -1,6 +1,7 @@ import React, { useRef } from "react" import { useEffect } from "react" import { useState } from "react" +import { MdCreateNewFolder } from "react-icons/md" interface Props { onPressed?: (dirName: string)=>void @@ -26,7 +27,7 @@ const CreateDirButton: React.FC = (props) => { }} > - Create Dir +
= (props) => { return ( <> - 📂 {props.dir.name} + {props.dir.name} diff --git a/src/components/FileBrowser.tsx b/src/components/FileBrowser.tsx index a882bf1..b601005 100644 --- a/src/components/FileBrowser.tsx +++ b/src/components/FileBrowser.tsx @@ -105,18 +105,26 @@ const FileBrowser: React.FC = () => { await handleDrop(files) }} > - handleDrop(files)} - /> - { - await createDirMutation({variables:{path:dirName}}) - refetchDir() - }} - /> - { - setPath(newPath) - }}/> +
+ { + setPath(newPath) + }}/> +
+ { + await createDirMutation({variables:{path:dirName}}) + refetchDir() + }} + /> +
+
+ handleDrop(files)} + /> +
+ +
+
{loading &&
Loading...
// TODO: center diff --git a/src/components/FileElement.tsx b/src/components/FileElement.tsx index 7b43f0d..76e683f 100644 --- a/src/components/FileElement.tsx +++ b/src/components/FileElement.tsx @@ -3,6 +3,7 @@ import PropTypes from "prop-types" import { File } from "../generated/graphql" import sizeToReadable from "../functions/sizeToReadable" import dateFormat from "../functions/dateFomat" +import { FaRegFileAlt } from "react-icons/fa" interface Props { file: File @@ -12,7 +13,7 @@ const FileElement: React.FC = (props) => { return ( <> - 📄 {props.file.name} + {props.file.name} {dateFormat(props.file.lastModified)} diff --git a/src/components/FileUploadButton.tsx b/src/components/FileUploadButton.tsx index 45aa7d9..0c37b87 100644 --- a/src/components/FileUploadButton.tsx +++ b/src/components/FileUploadButton.tsx @@ -1,5 +1,6 @@ import React from "react" import { useRef } from "react" +import { MdFileUpload } from "react-icons/md" interface Props { onUpload?: (files: FileList)=>void @@ -12,7 +13,7 @@ const FileUploadButton: React.FC = (props) => { return ( <> { if (inputRef.current && inputRef.current.files){ diff --git a/yarn.lock b/yarn.lock index 12d7c8c..d5035f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11955,6 +11955,11 @@ react-error-overlay@^6.0.9: resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz" integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew== +react-icons@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.2.0.tgz#6dda80c8a8f338ff96a1851424d63083282630d0" + integrity sha512-rmzEDFt+AVXRzD7zDE21gcxyBizD/3NqjbX6cmViAgdqfJ2UiLer8927/QhhrXQV7dEj/1EGuOTPp7JnLYVJKQ== + react-is@^16.7.0, react-is@^16.8.1: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" @@ -13169,11 +13174,6 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" -spectre.css@^0.5.9: - version "0.5.9" - resolved "https://registry.yarnpkg.com/spectre.css/-/spectre.css-0.5.9.tgz#86c732d093036d9fdc0a2ba570f005e4023ae6ca" - integrity sha512-9jUqwZmCnvflrxFGcK+ize43TvjwDjqMwZPVubEtSIHzvinH0TBUESm1LcOJx3Ur7bdPaeOHQIjOqBl1Y5kLFw== - split-on-first@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz"