From: Jérémy Fabre Date: Tue, 6 Sep 2016 15:19:01 +0000 (+0200) Subject: Tablet & mobile navigation implementation X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=7b867cdde2bc7ec39ae5fcfb79584c69473ef909;p=mezzo.git Tablet & mobile navigation implementation --- diff --git a/app/static/src/sass/config/_config.scss b/app/static/src/sass/config/_config.scss index 11d703c0..7811f550 100644 --- a/app/static/src/sass/config/_config.scss +++ b/app/static/src/sass/config/_config.scss @@ -2,6 +2,10 @@ $header-pre-height: 34px; $header-height: 78px; +$header-height-tablet: 70px; +$header-height-mobile: 70px; +$sidenav-width-tablet: 450px; +$sidenav-width-mobile: 300px; // Home diff --git a/app/static/src/sass/layout/_global.scss b/app/static/src/sass/layout/_global.scss index a10beeff..50eaf24b 100755 --- a/app/static/src/sass/layout/_global.scss +++ b/app/static/src/sass/layout/_global.scss @@ -1,9 +1,25 @@ -.banner { - position: relative; - z-index: 2; -} - .main { @include margin(3 0 0 0); @include padding(1 0 0 0); } + +#container { + @include mq($until: sm) { + margin-top: $header-height-tablet; + } + @include mq($until: xs) { + margin-top: $header-height-mobile; + } +} + +html, body { + + @include mq($until: sm) { + + overflow-x: hidden; + height: 100%; + -webkit-overflow-scrolling: touch; + + } + +} diff --git a/app/static/src/sass/layout/_header.scss b/app/static/src/sass/layout/_header.scss index c53e71bf..a0dda2d5 100755 --- a/app/static/src/sass/layout/_header.scss +++ b/app/static/src/sass/layout/_header.scss @@ -2,12 +2,31 @@ $module: ".header"; #{$module} { + z-index: 100; + position: relative; + + @include mq($until: sm) { + position: fixed; + width: 100%; + top: 0; + left: 0; + z-index: 100; + height: $header-height-tablet; + @include mq($until: xs) { + height: $header-height-mobile; + } + } + &__pre { background: $color-black; height: $header-pre-height; color: white; + @include mq($until: sm) { + display: none; + } + } &__nav { diff --git a/app/static/src/sass/modules/_all.scss b/app/static/src/sass/modules/_all.scss index 48d5e0d7..6e3f15db 100755 --- a/app/static/src/sass/modules/_all.scss +++ b/app/static/src/sass/modules/_all.scss @@ -3,6 +3,7 @@ @import "navs/nav-header"; @import "navs/nav-footer"; @import "navs/nav-tree"; +@import "sidebar"; // Boxes @import 'boxes/article-box'; diff --git a/app/static/src/sass/modules/_search.scss b/app/static/src/sass/modules/_search.scss index 82c533f5..ac838e7d 100644 --- a/app/static/src/sass/modules/_search.scss +++ b/app/static/src/sass/modules/_search.scss @@ -6,7 +6,7 @@ $module: ".search"; top: 0; left: 0; width: 100%; - z-index: 30; + z-index: 100; background: rgba(255,255,255, .95); diff --git a/app/static/src/sass/modules/_sidebar.scss b/app/static/src/sass/modules/_sidebar.scss new file mode 100644 index 00000000..289d2762 --- /dev/null +++ b/app/static/src/sass/modules/_sidebar.scss @@ -0,0 +1,32 @@ +$module: ".sidebar"; + +#{$module} { + + @include padding-bottom(1); + + &__menu { + + @include padding(0 1); + text-align: left; + list-style-type: none; + margin: 0; + + } + + &__menu-item { + + @include font-size(xl); + @include typeface(sans-serif); + @include line-height(2); + font-weight: weight(regular); + + a { + color: black; + &:hover { + color: black; + } + } + + } + +} diff --git a/app/static/src/sass/modules/navs/_nav-actions.scss b/app/static/src/sass/modules/navs/_nav-actions.scss index fea6adae..924e0eef 100644 --- a/app/static/src/sass/modules/navs/_nav-actions.scss +++ b/app/static/src/sass/modules/navs/_nav-actions.scss @@ -43,4 +43,54 @@ $module: ".nav-actions"; } + // + // Sidenav overrides + // + .sidebar & { + + @include padding(0.5 1); + text-align: left; + + &__item { + display: block; + @include margin(0 0 .5 0); + + &:nth-child(2):after { + display: none; + } + } + + &__item-link { + color: black; + @include font-size(l); + + &:hover { + color: black; + } + } + + &:before { + + display: block; + content: ""; + background: #979797; + width: 240px; + height: 1px; + @include margin(0 0 1.5 0); + + } + + &:after { + + display: block; + content: ""; + background: black; + width: 240px; + height: 6px; + @include margin(1.5 0 .5 0); + + } + + } + } diff --git a/app/static/src/sass/modules/navs/_nav-header.scss b/app/static/src/sass/modules/navs/_nav-header.scss index fd690b82..6dbd170e 100644 --- a/app/static/src/sass/modules/navs/_nav-header.scss +++ b/app/static/src/sass/modules/navs/_nav-header.scss @@ -9,6 +9,10 @@ $module: ".nav-header"; @include margin(.5 0); + @include mq($until: sm) { + @include margin(0); + } + &__item { display: inline-block; @@ -30,6 +34,10 @@ $module: ".nav-header"; @include margin-left(.5); } + &:first-child { + display: none; + } + &:last-child { &:after { display: none; @@ -41,6 +49,14 @@ $module: ".nav-header"; @include margin(0 0 0 .75); @include padding-right(.75); + @include mq($until: sm) { + img { + height: 70px; + width: auto; + display: block; + } + } + /*@include mq($until: md) { @include margin(0 0 0 .25); @include padding-right(.25); @@ -60,6 +76,15 @@ $module: ".nav-header"; &--centered { line-height: $header-height; + + @include mq($until: sm) { + line-height: $header-height-tablet; + height: $header-height-tablet; + } + @include mq($until: xs) { + line-height: $header-height-mobile; + height: $header-height-mobile; + } } &.hover { @@ -82,6 +107,28 @@ $module: ".nav-header"; } + @include mq($until: sm) { + + display: none; + &:first-child, + &:nth-child(2), + &:last-child { + display: inline-block; + } + + &:first-child { + float: left; + } + &:last-child { + float: right; + } + + &:after { + display: none; + } + + } + } &__item-link { @@ -178,4 +225,97 @@ $module: ".nav-header"; } + // + // Sidenav overrides + // + .sidebar & { + + @include padding(0.5 1 0 1); + text-align: left; + + &__item { + + display: block; + text-align: left; + @include margin-bottom(.5); + + &:first-child, + &:nth-child(1), + &:last-child { + display: none; + } + + &:nth-child(2) { + @include margin-bottom(1.5); + } + + &:nth-child(6) { + @include margin-bottom(0); + &:after { + + display: block; + position: static; + content: ""; + background: #979797; + width: 240px; + height: 1px; + @include margin(1.5 0 .5 0); + + } + } + + &.hover { + &:before { + display: none; + } + } + + &--special { + + display: inline-block; + width: 50%; + padding: 0; + margin: 0; + + a { + color: black; + } + + } + + &--image { + + display: inline-block; + width: 50%; + padding: 0; + margin: 0; + + img { + height: 80px; + width: auto; + display: block; + } + } + + } + + &__item-link { + + color: black; + @include font-size(xxl); + + &:hover { + color: black; + } + + } + + &__submenu { + + display: none !important; + + } + + } + } diff --git a/app/static/src/sass/modules/sliders/_slider-home.scss b/app/static/src/sass/modules/sliders/_slider-home.scss index f4dc80b4..c5112208 100644 --- a/app/static/src/sass/modules/sliders/_slider-home.scss +++ b/app/static/src/sass/modules/sliders/_slider-home.scss @@ -4,13 +4,16 @@ $module: ".slider-home"; position: relative; + @include mq($until: sm) { + @include margin-bottom(1); + } + ul { list-style-type: none; margin: 0; padding: 0; } - &__slide { width: 100%; diff --git a/app/static/src/sass/vendors/_all.scss b/app/static/src/sass/vendors/_all.scss index ad347e0c..258794df 100755 --- a/app/static/src/sass/vendors/_all.scss +++ b/app/static/src/sass/vendors/_all.scss @@ -1,2 +1,3 @@ @import "slick"; @import "lightslider"; +@import "pushy"; diff --git a/app/static/src/sass/vendors/_pushy.scss b/app/static/src/sass/vendors/_pushy.scss new file mode 100644 index 00000000..6eea386e --- /dev/null +++ b/app/static/src/sass/vendors/_pushy.scss @@ -0,0 +1,116 @@ +.pushy { + + width: $sidenav-width-tablet; + + @include mq($until: xs) { + width: $sidenav-width-mobile; + } + + background: #FFFFFF; + border-right: 1px solid #979797; + + a { + padding: 0; + } + +} + +.pushy-left { + + @include transform(translate3d(-$sidenav-width-tablet, 0, 0)); + + @include mq($until: xs) { + @include transform(translate3d(-$sidenav-width-mobile, 0, 0)); + } + +} + +.pushy-open-left #container, +.pushy-open-left .push { + + box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.50); + @include transform(translate3d($sidenav-width-tablet, 0, 0)); + + @include mq($until: xs) { + @include transform(translate3d($sidenav-width-mobile, 0, 0)); + } + +} + +.menu-btn { + position: relative; + width: 40px; + cursor: pointer; + + @include mq($until: sm) { + height: $header-height-tablet; + } + @include mq($until: xs) { + height: $header-height-mobile; + } + + .pushy-open-left & { + + span { + + &:before, + &:after { + opacity: 0; + } + + &.first { + @include transform(rotate(45deg)); + top: 33px; + } + &.second { + @include transform(rotate(-45deg)); + top: 33px; + } + + } + + } + + span { + display: block; + width: 40px; + height: 2px; + background: black; + position: relative; + position: absolute; + left: 0; + @include transition(all 0.2s ease-in-out); + &:before { + content: ""; + display: block; + width: 40px; + height: 2px; + background: black; + position: absolute; + left: 0; + top: -4px; + opacity: 1; + @include transition(all 0.2s ease-in-out); + } + &:after { + content: ""; + display: block; + width: 40px; + height: 2px; + background: black; + position: absolute; + left: 0; + bottom: -4px; + opacity: 1; + @include transition(all 0.2s ease-in-out); + } + } + + span.first { + top: 27px; + } + span.second { + top: 39px; + } + +} diff --git a/app/templates/base.html b/app/templates/base.html index cfafecfd..95c3bc29 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -34,6 +34,7 @@ {% compress css %} + {% endcompress %} @@ -42,97 +43,137 @@ {% spaceless %} -