fix for breadcrumbs, more design on aside-nav done

This commit is contained in:
Felix Hamann 2018-03-18 17:15:52 +01:00
parent 12f5cfe668
commit 61b17bc586
7 changed files with 123 additions and 65 deletions

View File

@ -63,14 +63,10 @@ body {
a, a,
a:visited { a:visited {
color: var(--darkbase);
text-decoration: none; text-decoration: none;
font-weight: 600; font-weight: 600;
transition: color .2s ease, background-color .2s ease; transition: color .2s ease, background-color .2s ease;
} }
a:hover {
color: var(--lightbase);
}
ul { ul {
list-style-type: none; list-style-type: none;
@ -138,6 +134,14 @@ th {
p { p {
margin: 10px 0; margin: 10px 0;
} }
a {
color: var(--darkbase);
}
a:hover {
color: var(--lightbase);
}
} }
.pseudo-focus { .pseudo-focus {

View File

@ -6,15 +6,25 @@
$case menuType $case menuType
$of NavbarAside (MenuItem label mIcon route _) $of NavbarAside (MenuItem label mIcon route _)
<li .asidenav__list-item :Just route == mcurrentRoute:.asidenav__list-item--active> <li .asidenav__list-item :Just route == mcurrentRoute:.asidenav__list-item--active>
$if isJust mIcon <a .asidenav__link-wrapper href=@{route}>
<div .glyphicon.glyphicon--#{fromMaybe "" mIcon}> $if isJust mIcon
<a .asidenav__link href=@{route}>#{label} <div .glyphicon.glyphicon--#{fromMaybe "" mIcon}>
<div .asidenav__link-label>#{label}
$of _ $of _
<div .asidenav__box> <div .asidenav__box--dont-hide>
<h3 .asidenav__box-title>WiSe 17/18 <h3 .asidenav__box-title>
<ul .asidenav__list.asidenav__list--padded> <a href="/course/W2017">WiSe 17/18
<li>Vorlesung 1 <ul .asidenav__list>
<li>Vorlesung 2 <li .asidenav__list-item>
<li>Vorlesung 3 <a .asidenav__link-wrapper href="/course/S2018/ixd/show">
<li>Vorlesung 4 <div .asidenav__link-triple>IXD
<div .asidenav__link-label>Interaction Design
<li .asidenav__list-item>
<a .asidenav__link-wrapper href="/course/S2018/ffp/show">
<div .asidenav__link-triple>FFP
<div .asidenav__link-label>Fortgeschrittene Funktionale Programmierung
<li .asidenav__list-item>
<a .asidenav__link-wrapper href="/course/S2018/dbs/show">
<div .asidenav__link-triple>DBS
<div .asidenav__link-label>Datenbanksysteme

View File

@ -3,12 +3,11 @@
window.utils = window.utils || {}; window.utils = window.utils || {};
window.utils.aside = function(el, bc) { window.utils.aside = function(asideEl, topNav) {
var asideEl = el;
var collapsed = false; var collapsed = false;
var collClass = 'main__aside--collapsed'; var collClass = 'main__aside--collapsed';
var animClass = 'main__aside--transitioning'; var animClass = 'main__aside--transitioning';
var breadcrumbs = bc; var aboveCollapsedNav = false;
init(); init();
function init() { function init() {
@ -16,16 +15,14 @@
if (document.body.getBoundingClientRect().width < 999 || collLS) { if (document.body.getBoundingClientRect().width < 999 || collLS) {
asideEl.classList.add(collClass); asideEl.classList.add(collClass);
collapsed = true; collapsed = true;
if (breadcrumbs) { if (topNav) {
breadcrumbs.style.left = '90px'; topNav.style.paddingLeft = '90px';
window.setTimeout(function() { window.setTimeout(function() {
breadcrumbs.classList.add('breadcrumbs__container--animated'); topNav.classList.add('navbar--animated');
}, 200); }, 200);
} }
} else { } else if (topNav) {
if (breadcrumbs) { topNav.classList.add('navbar--animated');
breadcrumbs.classList.add('breadcrumbs__container--animated');
}
} }
} }
@ -33,8 +30,8 @@
if (collapsed && !hasClass() || !collapsed && hasClass()) { if (collapsed && !hasClass() || !collapsed && hasClass()) {
asideEl.classList.add(animClass); asideEl.classList.add(animClass);
asideEl.classList.toggle(collClass, collapsed); asideEl.classList.toggle(collClass, collapsed);
if (breadcrumbs) { if (topNav) {
breadcrumbs.style.left = collapsed ? '90px' : ''; topNav.style.paddingLeft = collapsed ? '90px' : '';
} }
window.localStorage.setItem('asidenavCollapsed', collapsed); window.localStorage.setItem('asidenavCollapsed', collapsed);
} }
@ -49,21 +46,37 @@
collapsed = !collapsed; collapsed = !collapsed;
check(); check();
} }
}); }, false);
asideEl.addEventListener('transitionend', function(event) { asideEl.addEventListener('transitionend', function(event) {
if (event.propertyName === 'opacity') { if (event.propertyName === 'opacity') {
asideEl.classList.remove(animClass); asideEl.classList.remove(animClass);
} }
}); }, false);
window.addEventListener('resize', function() { window.addEventListener('resize', function() {
collapsed = document.body.getBoundingClientRect().width < 999; collapsed = document.body.getBoundingClientRect().width < 999;
check(); check();
}); }, false);
asideEl.addEventListener('mouseover', function(event) {
if (!collapsed) {
return false;
}
aboveCollapsedNav = true;
window.setTimeout(function() {
if (aboveCollapsedNav) {
asideEl.classList.add('pseudo-hover');
}
}, 430);
}, false);
asideEl.addEventListener('mouseleave', function(event) {
aboveCollapsedNav = false;
asideEl.classList.remove('pseudo-hover');
}, false);
}; };
})(); })();
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
utils.aside(document.querySelector('.main__aside'), document.querySelector('.breadcrumbs__container')); utils.aside(document.querySelector('.main__aside'), document.querySelector('.navbar'));
}); });

View File

@ -13,11 +13,16 @@
transition: opacity .2s ease; transition: opacity .2s ease;
} }
.main__aside--collapsed:hover { .main__aside--collapsed.pseudo-hover {
overflow: visible; overflow: visible;
} }
.main__aside--collapsed { .main__aside--collapsed {
width: 50px; width: 50px;
.asidenav__box-title {
width: 50px;
padding: 0;
}
} }
.main__aside--collapsed .asidenav__box { .main__aside--collapsed .asidenav__box {
opacity: 0; opacity: 0;
@ -47,22 +52,24 @@
.asidenav__box-title { .asidenav__box-title {
padding: 7px 13px; padding: 7px 13px;
}
.asidenav__list--padded { a {
padding: 0 13px; color: white;
}
} }
.asidenav__list-item { .asidenav__list-item {
position: relative; position: relative;
background-color: white; background-color: white;
color: var(--darkbase); color: var(--darkbase);
margin: 4px 0;
&:not(.asidenav__list-item--active):hover { &:not(.asidenav__list-item--active):hover {
color: white; color: white;
background-color: var(--darkbase); background-color: var(--darkbase);
.asidenav__link { .asidenav__link-wrapper,
.asidenav__link-label {
color: white; color: white;
} }
} }
@ -71,18 +78,35 @@
background-color: var(--darkbase); background-color: var(--darkbase);
color: white; color: white;
.asidenav__link { .asidenav__link-wrapper {
pointer-events: none; pointer-events: none;
color: white; color: white;
} }
} }
.asidenav__link { .asidenav__link-wrapper {
position: relative; position: relative;
display: block; display: flex;
line-height: 50px; height: 50px;
margin: 4px 0; align-items: center;
padding-left: 54px; justify-content: flex-start;
color: var(--darkbase); color: var(--darkbase);
z-index: 1; z-index: 1;
.glyphicon {
width: 50px;
}
.asidenav__link-triple {
background-color: var(--darkbase);
color: white;
height: 50px;
width: 50px;
display: inline-block;
line-height: 50px;
text-align: center;
margin-right: 13px;
flex-shrink: 0;
outline: 1px solid white;
}
} }

View File

@ -1,9 +1,10 @@
.breadcrumbs__container { .breadcrumbs__container {
position: absolute; position: relative;
color: white; color: white;
left: 340px; z-index: 10;
bottom: 20px; align-self: flex-end;
z-index: 100; margin-bottom: 20px;
transition: margin-bottom .2s ease;
} }
.breadcrumbs__container--animated { .breadcrumbs__container--animated {
transition: left .2s ease; transition: left .2s ease;
@ -11,9 +12,3 @@
.breadcrumbs__container .breadcrumbs__link { .breadcrumbs__container .breadcrumbs__link {
color: white; color: white;
} }
@media (max-width: 999px) {
.breadcrumbs__container {
left: 90px;
}
}

View File

@ -1,6 +1,10 @@
<div .navbar-container> <div .navbar-container>
<nav .navbar.js-sticky-navbar> <nav .navbar.js-sticky-navbar>
<!-- breadcrumbs -->
$if not $ Just HomeR == mcurrentRoute
^{breadcrumbs}
<ul .navbar__list.list--inline> <ul .navbar__list.list--inline>
$forall menuType <- menuTypes $forall menuType <- menuTypes
$case menuType $case menuType
@ -18,8 +22,4 @@
<div .navbar__link-label>#{label} <div .navbar__link-label>#{label}
$of _ $of _
<!-- breadcrumbs -->
$if not $ Just HomeR == mcurrentRoute
^{breadcrumbs}
<div .navbar__pushdown> <div .navbar__pushdown>

View File

@ -3,10 +3,11 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: space-between;
width: 100%; width: 100%;
height: var(--header-height); height: var(--header-height);
padding-right: 5vw; padding-right: 5vw;
padding-left: 340px;
background: var(--darkbase); /* Old browsers */ background: var(--darkbase); /* Old browsers */
background: -moz-linear-gradient(bottom, var(--darkbase) 0%, #425d79 100%); /* FF3.6-15 */ background: -moz-linear-gradient(bottom, var(--darkbase) 0%, #425d79 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(bottom, var(--darkbase) 0%,#425d79 100%); /* Chrome10-25,Safari5.1-6 */ background: -webkit-linear-gradient(bottom, var(--darkbase) 0%,#425d79 100%); /* Chrome10-25,Safari5.1-6 */
@ -14,7 +15,15 @@
color: white; color: white;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
z-index: 10; z-index: 10;
top: 0;
left: 0;
overflow: hidden; overflow: hidden;
transition: height 0.2s ease;
}
.navbar__list {
align-self: flex-end;
white-space: nowrap;
} }
.navbar__list-item { .navbar__list-item {
@ -31,6 +40,9 @@
height: 20px; height: 20px;
} }
} }
.navbar :last-child {
margin-left: auto;
}
.navbar .navbar__link-wrapper { .navbar .navbar__link-wrapper {
display: flex; display: flex;
@ -39,6 +51,7 @@
align-items: center; align-items: center;
height: 80px; height: 80px;
color: var(--whitebase); color: var(--whitebase);
transition: height .2s ease;
} }
.navbar__link-label { .navbar__link-label {
@ -88,21 +101,20 @@
} }
.navbar--sticky { .navbar--sticky {
position: fixed;
top: 0;
left: 0;
height: var(--header-height-collapsed); height: var(--header-height-collapsed);
z-index: 100; z-index: 100;
transition: height 0.2s ease, line-height 0.2s ease;
.navbar__link { .navbar__link-wrapper {
/*opacity: 0;*/ height: 50px;
} }
.breadcrumbs__container--animated { .breadcrumbs__container {
bottom: 7px; margin-bottom: 7px;
transition: all .2s ease;
} }
}
.navbar--animated {
transition: all .2s ease;
} }
.navbar__pushdown { .navbar__pushdown {
/*display: none;*/ /*display: none;*/