diff --git a/src/Components/Case/CaseListPage.js b/src/Components/Case/CaseListPage.js index 20abe22..a1db39b 100644 --- a/src/Components/Case/CaseListPage.js +++ b/src/Components/Case/CaseListPage.js @@ -1,7 +1,8 @@ -import React, { useEffect, useContext, useState } from "react"; +import React, { useEffect, useContext, useState, useRef } from "react"; import { useNavigate } from "react-router-dom"; import { CaseCard } from "../../pageElements/Cards.js"; import CreateModal from "../Modals/CreateModal.js"; +import MobileContent from "../MobileContent.js"; import { db } from "../../firebase"; import { AppContext } from "../../Hooks/useContext/appContext"; import SelectDropdown from "../../pageElements/SelectDropdown"; @@ -10,6 +11,9 @@ import ListPagination from "../../pageElements/ListPagination.js"; import Button from "../../pageElements/Button"; const CaseListPage = ({ perPage }) => { + const size = window.innerWidth < 440; + const [isMobile, setIsMobile] = useState(size); + const count = useRef(null); const navigate = useNavigate(); const [showModal, setShowModal] = useState(false); const [allCases, setAllCases] = useState(null); @@ -20,6 +24,15 @@ const CaseListPage = ({ perPage }) => { const { group } = appState; const appUserId = group ? group.appUserId : null; + useEffect(() => { + if (count.current == null) { + setIsMobile(window.innerWidth < 440); + } + return () => { + count.current = 1; + }; + }, []); + function getCases() { if (!appUserId) { setAllCases([]); @@ -85,68 +98,72 @@ const CaseListPage = ({ perPage }) => { if (!group) { return null; } - - return ( - <> -
-

Active Cases

-
- {group.firm} + console.log("window.innerWidth < 440", window.innerWidth < 440); + const DesktopContent = () => { + return ( + <> +
+

Active Cases

+
+ {group.firm} +
-
- {showModal ? : <>} - {allCases === null ?
Loading...
: null} - {allCases !== null ? ( - allCases.length > 0 ? ( - <> -
- -
-
- {allCases - .slice((page - 1) * perPage, page * perPage) - .map((c, i) => ( - - ))} -
- {totalPages > 1 ? ( -
- : <>} + {allCases === null ?
Loading...
: null} + {allCases !== null ? ( + allCases.length > 0 ? ( + <> +
+
- ) : null} - {createNewButton()} - - ) : ( -
-

You have not created any cases yet.

-

- To get started, click "Create New Case" and enter case - information. -

- {createNewButton()} -
- ) - ) : null} - - ); +
+ {allCases + .slice((page - 1) * perPage, page * perPage) + .map((c, i) => ( + + ))} +
+ {totalPages > 1 ? ( +
+ +
+ ) : null} + {createNewButton()} + + ) : ( +
+

You have not created any cases yet.

+

+ To get started, click "Create New Case" and enter case + information. +

+ {createNewButton()} +
+ ) + ) : null} + + ); + }; + + return isMobile ? : ; }; export default CaseListPage; diff --git a/src/Components/MobileContent.js b/src/Components/MobileContent.js new file mode 100644 index 0000000..f06332c --- /dev/null +++ b/src/Components/MobileContent.js @@ -0,0 +1,27 @@ +import legalTechFlip from "../Assets/Images/legalTechFlip.jpg"; +const MobileContent = ({ isDashboard }) => { + const copy = isDashboard + ? "hello dash" + : "Novodraft is a desktop application. Please login on your desktop device to use this feature"; + + return ( + <> +
+ {!isDashboard ? ( + <> +
+
+ +
+ + ) : ( + <> + )} +
{copy}
+
+
+ + ); +}; + +export default MobileContent; diff --git a/src/styles/app.scss b/src/styles/app.scss index 4bac361..2200686 100644 --- a/src/styles/app.scss +++ b/src/styles/app.scss @@ -70,4 +70,33 @@ p { /*** Media Queries **/ @media only screen and (max-width: 430px) { + .mobile-content-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + margin: 18px 2px 0px 2px; + padding: 2px 2px; + background-color: var(--background-blue); + border-radius: 18px; + } + + .mobile-divider { + height: 8px; + width: 88%; + margin: 2px 0px 16px 0px; + padding: 6px 0px; + border-bottom: 1px solid var(--accent-orange-light); + } + + .mobile-info-heading { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + margin: 28px 6px 2px 6px; + text-align: justify; + font-size: 15px; + line-height: 21px; + } }