Add "Home" button for navigation

main
sudoer777 2021-11-26 12:46:16 -07:00
parent 872397d05e
commit 3201ffb2a9
5 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const logInButton = document.getElementById('login-button'); const logInButton = document.getElementById('login-button');
const logOutButton = document.getElementById('logout-button'); const logOutButton = document.getElementById('logout-button');
const homeButton = document.getElementById('home-button');
if(logInButton) { if(logInButton) {
logInButton.addEventListener('click', () => { logInButton.addEventListener('click', () => {
@ -12,3 +13,9 @@ if(logOutButton) {
window.location.href = "/auth/logout"; window.location.href = "/auth/logout";
}); });
} }
if(homeButton) {
homeButton.addEventListener('click', () => {
window.location.href = '/';
});
}

View File

@ -25,3 +25,6 @@ tr {
flex-direction: row; flex-direction: row;
} }
#actions-div {
margin-left: auto;
}

View File

@ -26,5 +26,8 @@ a {
#actions-div { #actions-div {
display: flex; display: flex;
margin-left: auto; }
#home-button {
margin-right: auto;
} }

View File

@ -3,7 +3,7 @@ var router = express.Router();
/* GET home page. */ /* GET home page. */
router.get('/', function(req, res, next) { router.get('/', function(req, res, next) {
res.render('index', { title: 'View Scores', userLoggedIn: !!req.user }); res.render('index', { title: 'View Scores', userLoggedIn: !!req.user, hideHomeButton: true });
}); });
module.exports = router; module.exports = router;

View File

@ -8,6 +8,8 @@ html
body body
div#mobile-view div#mobile-view
div#actions-div div#actions-div
if !hideHomeButton
button#home-button Home
block actions block actions
if userLoggedIn if userLoggedIn
button#logout-button Log out button#logout-button Log out