added font-awesome icons to navbar

This commit is contained in:
Felix Hamann 2018-06-23 13:24:24 +02:00
parent 879e1717ee
commit b1ffef00a0
4 changed files with 39 additions and 41 deletions

View File

@ -3,6 +3,7 @@ $newline never
<div .asidenav> <div .asidenav>
<div .asidenav__box> <div .asidenav__box>
<h3 .asidenav__box-title> <h3 .asidenav__box-title>
$# TODO: this has to come from favourites somehow. Show favourites from older terms?
WiSe 17/18 WiSe 17/18
<ul .asidenav__list> <ul .asidenav__list>
$forall (Course{..}, courseRoute, pageActions) <- favourites $forall (Course{..}, courseRoute, pageActions) <- favourites

View File

@ -6,16 +6,26 @@
flex: 0 0 300px; flex: 0 0 300px;
min-height: calc(100% - 80px); min-height: calc(100% - 80px);
transition: all .2s ease-out; transition: all .2s ease-out;
width: 300px; width: 24%;
~ .main__content { ~ .main__content {
padding-left: 300px; padding-left: 24%;
transition: padding-left .2s ease-out; transition: padding-left .2s ease-out;
} }
} }
/* maximum width of 300px for wide screens */
@media (min-width: 1200px) {
.main__aside {
width: 300px;
~ .main__content {
padding-left: 300px;
}
}
}
.asidenav { .asidenav {
width: 300px;
color: white; color: white;
} }
@ -33,7 +43,6 @@
.asidenav__list-item { .asidenav__list-item {
position: relative; position: relative;
color: var(--color-lightwhite); color: var(--color-lightwhite);
padding-left: 10px;
&:hover { &:hover {
color: var(--color-link); color: var(--color-link);
@ -61,6 +70,14 @@
} }
} }
/* small list-item-padding for medium to large screens */
@media (min-width: 1024px) {
.asidenav__list-item {
padding-left: 10px;
}
}
.asidenav__list-item--active { .asidenav__list-item--active {
background-color: var(--color-lightwhite); background-color: var(--color-lightwhite);
@ -79,7 +96,7 @@
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 7px 0; padding: 7px 10px;
justify-content: flex-start; justify-content: flex-start;
color: var(--color-lightwhite); color: var(--color-lightwhite);
z-index: 1; z-index: 1;
@ -100,7 +117,6 @@
.asidenav__link-label { .asidenav__link-label {
line-height: 1; line-height: 1;
padding-left: 13px;
} }
/* hover sub-menus */ /* hover sub-menus */
@ -153,11 +169,6 @@
padding-left: 50px; padding-left: 50px;
} }
&.pseudo-hover {
overflow: visible;
flex-basis: 300px;
}
.asidenav__box-title { .asidenav__box-title {
width: 50px; width: 50px;
padding: 1px; padding: 1px;
@ -193,22 +204,14 @@
} }
} }
.asidenav__list-item:hover {
> .asidenav__link-wrapper {
color: var(--color-dark);
background-color: var(--color-lightwhite);
}
}
.asidenav__link-wrapper { .asidenav__link-wrapper {
color: var(--color-lightwhite); color: var(--color-lightwhite);
padding: 0; padding: 0;
// background-color: var(--color-dark);
} }
.asidenav__nested-list,
.asidenav__link-label { .asidenav__link-label {
padding-left: 0; display: none;
} }
.asidenav__list-item--active { .asidenav__list-item--active {
@ -218,5 +221,6 @@
color: var(--color-dark); color: var(--color-dark);
} }
} }
} }
} }

View File

@ -9,11 +9,10 @@ $newline never
$forall menuType <- menuTypes $forall menuType <- menuTypes
$case menuType $case menuType
$of NavbarAside (MenuItem label mIcon route _) $of NavbarAside (MenuItem label mIcon route _)
<li .navbar-left__list-item :highlight route:.asidenav__list-item--active> <li .navbar-left__list-item :highlight route:.navbar-left__list-item--active>
<!-- TODO: rename classes to match navbar --> <a .navbar-left__link-wrapper href=@{route}>
<a .asidenav__link-wrapper href=@{route}> <i .fas.fa-#{fromMaybe "none" mIcon}.fa-2x>
<div .glyphicon.glyphicon--#{fromMaybe "none" mIcon}> <div .navbar-left__link-label>#{label}
<div .asidenav__link-label>#{label}
$of _ $of _
<ul .navbar-right__list.list--inline> <ul .navbar-right__list.list--inline>

View File

@ -11,29 +11,23 @@
window.setTimeout(function () { window.setTimeout(function () {
nav.classList.add('navbar--animated'); nav.classList.add('navbar--animated');
}, 200); }, 200);
checkScroll();
addListener();
}
// checks scroll direction and shows/hides navbar accordingly
function checkScroll() {
var sticky = window.scrollY > 0;
sticky = sticky && window.innerHeight < (document.scrollingElement.scrollHeight - 100);
nav.classList.toggle('navbar--sticky', sticky);
ticking = false;
}
function addListener() {
window.addEventListener('scroll', function (e) { window.addEventListener('scroll', function (e) {
if (!ticking) { if (!ticking) {
window.requestAnimationFrame(checkScroll); window.requestAnimationFrame(update);
ticking = true; ticking = true;
} }
}, false); }, false);
update();
}
function update() {
var sticky = window.scrollY > 0;
sticky = sticky && window.innerHeight < (document.scrollingElement.scrollHeight - 200);
nav.classList.toggle('navbar--sticky', sticky);
ticking = false;
} }
} }
})(); })();
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {