From d1552c2cbeefcc771d7ccb7413fb90b1d67b4280 Mon Sep 17 00:00:00 2001 From: andiedoescode Date: Tue, 9 Apr 2024 12:45:53 -0400 Subject: [PATCH] Conditional styling for List and ManageList when logged out, padding adjustment to ListHeader component --- src/components/ListHeader.jsx | 2 +- src/views/List.jsx | 117 +++++++++++++++++++--------------- src/views/ManageList.jsx | 106 ++++++++++++++++-------------- 3 files changed, 124 insertions(+), 101 deletions(-) diff --git a/src/components/ListHeader.jsx b/src/components/ListHeader.jsx index 427149c..87dd7af 100644 --- a/src/components/ListHeader.jsx +++ b/src/components/ListHeader.jsx @@ -1,6 +1,6 @@ export function ListHeader({ text }) { return ( -

+

{text}

); diff --git a/src/views/List.jsx b/src/views/List.jsx index c047f6d..0c59643 100644 --- a/src/views/List.jsx +++ b/src/views/List.jsx @@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'; import { comparePurchaseUrgency } from '../api/firebase'; import { AddItem, ListItem } from '../components'; import { ListHeader } from '../components/ListHeader.jsx'; +import { auth } from '../api/config.js'; export function List({ data, listPath }) { const [searchTerm, setSearchTerm] = useState(''); @@ -32,64 +33,74 @@ export function List({ data, listPath }) { return ( <> - {listPath ? : null} - {!listPath ? ( + {!auth.currentUser ? ( +
+ Sign in to see your lists. +
+ ) : ( <> - -
- -
- - ) : null} - -
- {listPath ? : null} - {data.length > 0 ? ( -
-
- - - {searchTerm ? ( + {listPath ? : null} + {!listPath ? ( + <> + +
- ) : null} - -
- ) : null} - {listPath && data.length === 0 ? ( -
-

- This list is currently empty! -

-
- ) : null} + + + ) : null} -
-
    - {filteredData.map((item) => { - return ; - })} -
-
-
+
+ {listPath ? : null} + {data.length > 0 ? ( +
+
+ + + {searchTerm ? ( + + ) : null} +
+
+ ) : null} + {listPath && data.length === 0 ? ( +
+

+ This list is currently empty! +

+
+ ) : null} + +
+
    + {filteredData.map((item) => { + return ( + + ); + })} +
+
+
+ + )} ); } diff --git a/src/views/ManageList.jsx b/src/views/ManageList.jsx index e7cf762..f30732b 100644 --- a/src/views/ManageList.jsx +++ b/src/views/ManageList.jsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { deleteList, shareList } from '../api/firebase.js'; import { ListHeader } from '../components/ListHeader.jsx'; +import { auth } from '../api/config.js'; export function ManageList({ setListPath, listPath, userEmail, userId }) { const navigate = useNavigate(); @@ -59,59 +60,70 @@ export function ManageList({ setListPath, listPath, userEmail, userId }) { return ( <> - {listPath ? ( + {!auth.currentUser ? ( +
+ Sign in to manage lists. +
+ ) : ( <> - -
-
-
- -
-
- + {listPath ? ( + <> + +
+ +
+ +
+
+ + +
+ +
+
+

List Options

+ +
+ + ) : null} + {!listPath ? ( + <> + +
- -
-
-

List Options

- -
- - ) : null} - {!listPath ? ( - <> - -
- -
+ + ) : null} - ) : null} + )} ); }