From 10476cd4155f63ce16f4e57db8ff5598790186c6 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Sat, 23 Apr 2022 10:19:26 +0200 Subject: [PATCH] Conditional rendering for components --- src/client/src/FrontPage.js | 12 +++++++++--- src/client/src/LoginPage.js | 12 ++++++++---- src/client/src/TournamentOverview.js | 16 +++++++++++----- src/client/src/components/AsuraBar.js | 19 +++++++++++++------ 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/client/src/FrontPage.js b/src/client/src/FrontPage.js index ed56948..74025ae 100644 --- a/src/client/src/FrontPage.js +++ b/src/client/src/FrontPage.js @@ -14,6 +14,8 @@ import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp import EditIcon from '@mui/icons-material/Edit'; import EmojiEventsIcon from '@mui/icons-material/EmojiEvents'; +let isLoggedIn = true; + function CreateButton(props) { return ( @@ -111,11 +113,13 @@ function TournamentListItem(props) { - + { isLoggedIn ? + - + : null + } @@ -55,8 +60,6 @@ function NotLoggedInButton() { } export default function Appbar(props) { - const isLoggedIn = true; // props.isLoggedIn; - return ( <> @@ -81,9 +84,13 @@ export default function Appbar(props) {

{props.pageTitle || ""}

- + { props.pageTitle !== "Sign in" ? + { isLoggedIn ? : } - + : + + + }