diff --git a/src/App.module.scss b/src/App.module.scss index 54f57fa..e1d0341 100644 --- a/src/App.module.scss +++ b/src/App.module.scss @@ -1,3 +1,9 @@ .imageOpener{ - width: 90%; + +} + +.imageOpenerImage{ + display: block; + margin-left: auto; + margin-right: auto; } \ No newline at end of file diff --git a/src/components/FileBrowser.tsx b/src/components/FileBrowser.tsx index dee3b2c..4f8f0ec 100644 --- a/src/components/FileBrowser.tsx +++ b/src/components/FileBrowser.tsx @@ -10,7 +10,7 @@ const FileBrowser: React.FC = () => { const [openFileId, setOpenFileId] = useState("") const [showFile, setShowFile] = useState(false) - const { data } = useOpenDirQuery({ + const { data, loading } = useOpenDirQuery({ variables:{ path } @@ -22,6 +22,9 @@ const FileBrowser: React.FC = () => { setPath(newPath) }}/>
+ {loading && +
// TODO: center + } diff --git a/src/components/FileOpen.tsx b/src/components/FileOpen.tsx index 49314c7..80a18c4 100644 --- a/src/components/FileOpen.tsx +++ b/src/components/FileOpen.tsx @@ -3,6 +3,8 @@ import PropTypes from "prop-types" import { useGetFileQuery } from "../generated/graphql" import ImageOpener from "./ImageOpener" import TextOpener from "./TextOpener" +import Modal from "./Modal" +import { useState } from "react" interface Props { id: string @@ -49,14 +51,11 @@ const FileOpen: React.FC = (props) => { } return ( -
- { - props.onCloseClick?.() - }}>❌ -
- {opener} -
-
+ { + props.onCloseClick?.() + }} show={props.show} > + {opener} + ) } diff --git a/src/components/ImageOpener.tsx b/src/components/ImageOpener.tsx index bd328f0..d22dcf1 100644 --- a/src/components/ImageOpener.tsx +++ b/src/components/ImageOpener.tsx @@ -11,7 +11,7 @@ interface Props { const ImageOpener: React.FC = (props) => { return (
- +
) } diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx new file mode 100644 index 0000000..de7d205 --- /dev/null +++ b/src/components/Modal.tsx @@ -0,0 +1,21 @@ +import React from "react" +import style from "./../style/Modal.module.scss" + +interface Props { + show: boolean + onCloseClick?: ()=>void +} + +const Modal: React.FC = (props) => { + return ( +
{ + props.onCloseClick?.() + }}> +
+ {props.children} +
+
+ ) +} + +export default Modal \ No newline at end of file diff --git a/src/index.scss b/src/index.scss index e69de29..0a1a230 100644 --- a/src/index.scss +++ b/src/index.scss @@ -0,0 +1,2 @@ + +@import "node_modules/spectre.css/src/spectre"; \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 318f99e..7bd0e1f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,6 @@ import ReactDOM from "react-dom" import "./index.scss" import App from "./App" import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client" -import "spectre.css" const client = new ApolloClient({ uri: "/graphql", diff --git a/src/style/Modal.module.scss b/src/style/Modal.module.scss new file mode 100644 index 0000000..f94751f --- /dev/null +++ b/src/style/Modal.module.scss @@ -0,0 +1,21 @@ +.overlay{ + position: fixed; + z-index: 1; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0,0,0,0.4); +} + +.body{ + background-color: #fefefe; + margin: 15% auto; /* 15% from the top and centered */ + padding: 20px; + border: 1px solid #888; + width: 80%; /* Could be more or less, depending on screen size */ +} + +.hidden{ + display: none; +} \ No newline at end of file