Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created the navbar #61

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/main/webapp/CSS/navbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*{
margin: 0;
padding: 0;
}

body{
width: 100%;
}

#navbarDiv{
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: center;
}

.divButtons{
display: flex;
justify-content: center;
width: 25%;
height: 10%;
}
56 changes: 56 additions & 0 deletions src/main/webapp/JS/navbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const homeIcon = $("#homeIcon")
const homeIconS = $("#homeIconSelected")
const messageIcon = $("#messageIcon")
const messageIconS = $("#messageIconSelected")
const calendarIcon = $("#calendarIcon")
const calendarIconS = $("#calendarIconSelected")
const profileIcon = $("#profileIcon")
const profileIconS = $("#profileIconSelected")

const page = window.location.pathname.split('/').pop()
const homePages = [] //TODO: Mettere le pagine da considerare "Home"
const messagePages = [] //TODO: Mettere le pagine da considerare "Message"
const calendarPages = [] //TODO: Mettere le pagine da considerare "Calendar"
const profilePages = [] //TODO: Mettere le pagine da considerare "Profile"

$("document").ready(()=>{
hideSelectedIcons();
showRightIcons();
manageOnClick();
})

function hideSelectedIcons(){
homeIconS.hide()
messageIconS.hide()
calendarIconS.hide()
profileIconS.hide()
}

function showRightIcons(){
if (homePages.includes(page)){
homeIcon.hide();
homeIconS.show();
}else if (messagePages.includes(page)){
messageIcon.hide();
messageIconS.show();
}else if (calendarPages.includes(page)){
calendarIcon.hide();
calendarIconS.show();
}else if (profilePages.includes(page)){
profileIcon.hide();
profileIconS.show();
}else{
$("#navbarDiv").hide();
}
}

function manageOnClick(){
$("#home").click(() => redirect("home.jsp")); //TODO: METTERE I GIUSTI REDIRECT
$("#message").click(() => redirect("message.jsp")); //TODO: METTERE I GIUSTI REDIRECT
$("#calendar").click(() => redirect("calendar.jsp")); //TODO: METTERE I GIUSTI REDIRECT
$("#profile").click(() => redirect("profile.jsp")); //TODO: METTERE I GIUSTI REDIRECT
}

function redirect(where){
window.location.href = where
}
28 changes: 28 additions & 0 deletions src/main/webapp/JSP/navbar.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<html lang="it">
<head>
<title>navbar</title>
</head>
<body>
<div id="navbarDiv" >
<div id="home" class="divButtons">
<img id="homeIcon" src="../images/home.svg" alt="homeIcon">
<img id="homeIconSelected" src="../images/homeSelected.svg" alt="homeIconSelected">
</div>
<div id="message" class="divButtons">
<img id="messageIcon" src="../images/message.svg" alt="messageIcon">
<img id="messageIconSelected" src="../images/messageSelected.svg" alt="messageIconSelected">
</div>
<div id="calendar" class="divButtons">
<img id="calendarIcon" src="../images/calendar.svg" alt="calendarIcon">
<img id="calendarIconSelected" src="../images/calendarSelected.svg" alt="calendarIconSelected">
</div>
<div id="profile" class="divButtons">
<img id="profileIcon" src="../images/profile.svg" alt="profileIcon">
<img id="profileIconSelected" src="../images/profileSelected.svg" alt="profileIconSelected">
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2" crossorigin="anonymous"></script>
<script src="../JS/navbar.js"></script>
<link rel="stylesheet" href="../CSS/navbar.css">
</html>
1 change: 1 addition & 0 deletions src/main/webapp/images/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/calendarSelected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/homeSelected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/messageSelected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/profile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/webapp/images/profileSelected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading