Skip to content

Commit

Permalink
adds dropdown menu and progress bar now changes with user points
Browse files Browse the repository at this point in the history
Relates #56
  • Loading branch information
SleepySheepy172 committed Sep 19, 2018
1 parent 7ebfeb3 commit 9cfa748
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 37 deletions.
4 changes: 3 additions & 1 deletion private/sass/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
background-color: $navy1;
position: fixed;
bottom: 0;
width:100%;
min-width:70%;
height: $large;
border-top-right-radius: 10px;
}

#foot-navbar > a {
color: $white;
text-decoration: none;
margin: 0 $font-h3;
}
42 changes: 34 additions & 8 deletions private/sass/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,27 @@ nav{
position: fixed;
top:0;
right: 0;
min-width: 50%;
min-width: 70%;
height: $large;
z-index: 10;
display: flex;
justify-content: space-between;
align-items: center;
background-color: $navy1;
color: $white;
padding: $smallest;
border-bottom-left-radius: 10px;
}


#xp-section{
display:flex;
align-items:center;
align-items:center;
justify-content: space-around;
min-width: 60%;
}
#xp-section > h3{
margin: $small;
margin-left: $medium;
margin: 0 $small;
font-weight: 500;
}
#xp-bar{
margin: $small;
Expand Down Expand Up @@ -50,16 +54,38 @@ appearance: none;
}

#avatar-section{
text-align: right;
position: fixed;
right: 0;
top: $large;
}
#profile-pic{
height: 4rem;
border: $navy1 $small solid;
border-radius: 100%;
margin-right: $smallest;
}
#avatar-section > h4{
nav > h4{
font-size: $medium;
margin: 0;
margin: $small;
}
.level{
margin-left: $small;
margin-right: $small;
}

.popout-menu {
position: absolute;
top: 0;
left: 0;
z-index: 1;
height: $godzilla;
width: 100vw;
transform: translateY(-100%);
background-color: $navy1;
transition: all 0.5s ease-in;
box-shadow: 1px 0 3px grey;
}

.popout-menu--visible {
transform: translateY(0);
}
3 changes: 3 additions & 0 deletions private/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
@import "sizes";
@import "reset";

// paste line below into terminal to keep css updating
// sass --watch private/sass:public/css

*{
box-sizing: border-box;
}
Expand Down
4 changes: 3 additions & 1 deletion public/css/footer.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/css/footer.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 34 additions & 6 deletions public/css/navbar.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/css/navbar.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions public/css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion public/js/navbar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@

var getPoints = document.querySelector(".getPoints");
var xpBar = document.querySelector("#xp-bar");


(() => {
const menuBtn = document.querySelector('.menu-button');
const popoutMenu = document.querySelector('.popout-menu');
menuBtn.addEventListener('click', () =>
toggleMenu(popoutMenu, menuBtn)
);
})();

function toggleMenu(menu, button) {
// button.classList.toggle('app_drawer__button--visible');
menu.classList.toggle('popout-menu--visible');
}

function render(number) {
getPoints.innerHTML = number
getPoints.innerHTML = (number + "/50");
xpBar.setAttribute("value", number);
}

fetch("http://localhost:3000/userpoints/")
Expand All @@ -12,3 +29,5 @@ fetch("http://localhost:3000/userpoints/")
})




11 changes: 8 additions & 3 deletions src/views/partials/navbar.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<header>
<nav>
<div id="xp-section">
<h3 class="getPoints"></h3>
<h3>XP</h3>
<progress max="100" value="50" id="xp-bar"></progress>
<h4 class="getPoints"></h4>
<progress max="50" value="40" id="xp-bar"></progress>
</div>
<div id="avatar-section">
<h4 class="level">Waste Warrior</h4>
<div id="avatar-section">
<button class="menu-button">
<img id="profile-pic" src="/public/imgs/Avatar.png" alt="Profile picture">
</button>
</div>
</nav>
<menu class="popout-menu">

</menu>
</header>

0 comments on commit 9cfa748

Please sign in to comment.