hugo-theme-zzo/assets/sass/layout/_navigation.scss

552 lines
12 KiB
SCSS
Raw Normal View History

.navbar {
2019-11-04 13:09:44 +00:00
margin: auto;
width: inherit;
max-width: inherit;
2019-11-11 14:44:13 +00:00
height: $grid_navbar_height;
2019-11-04 13:09:44 +00:00
z-index: z('navbar');
position: fixed;
left: 0;
right: 0;
top: 0;
&[data-dir="rtl"] {
direction: rtl;
}
2019-11-04 13:09:44 +00:00
&[data-dir="ltr"] {
direction: ltr;
}
@media only screen and (max-width: 769px) {
&[data-dir="rtl"] {
direction: ltr;
}
}
2019-11-04 13:09:44 +00:00
@include transition(all, 0.2s, ease);
@include flexbox();
@include justify-content(space-between);
@include themify($themes) {
border-bottom: 1px solid themed('navbar-border-bottom-color');
background-color: themed('navbar-background-color');
}
&--hide {
2019-11-11 14:44:13 +00:00
top: -$grid_navbar_height;
2019-11-04 13:09:44 +00:00
}
&--show {
top: 0;
}
&__slide-down {
2020-01-26 08:48:03 +00:00
svg {
margin: auto;
display: block;
}
2020-01-23 13:00:38 +00:00
@include themify($themes) {
background-color: themed('navbar-background-color') !important;
2020-02-20 10:08:38 +00:00
2020-01-23 13:00:38 +00:00
@include on-event {
2020-02-20 10:08:38 +00:00
color: themed('navbar-title-hover-color');
2020-01-23 13:00:38 +00:00
}
}
2020-02-16 18:55:32 +00:00
&[data-ani="true"] {
@media only screen and (min-width: 769px) {
@for $i from 1 through 8 {
&:nth-child(#{$i}) {
@include animation('slide-in-down .25s #{$i * .1}s 1 ease both');
}
}
}
}
}
2019-11-20 06:55:05 +00:00
2019-11-04 13:09:44 +00:00
&__brand {
height: $grid_navbar_height;
2019-11-04 13:09:44 +00:00
@include flexbox();
@include align-items(center);
2019-11-20 06:55:05 +00:00
@include flex-shrink(0);
2019-11-04 13:09:44 +00:00
}
2020-01-23 13:00:38 +00:00
&__burger {
2019-11-04 13:09:44 +00:00
display: none;
&[data-ani="true"] {
@include animation('slide-in-down .5s .0s 1 ease both');
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
2019-11-04 13:09:44 +00:00
cursor: pointer;
margin-left: auto;
2019-11-11 14:44:13 +00:00
height: $grid_navbar_height;
width: 35px;
position: absolute;
right: 0;
2019-11-04 13:09:44 +00:00
@include flexbox();
@include align-items(center);
@include justify-content(flex-end);
@include themify($themes) {
background: themed('navbar-background-color');
2020-02-16 18:55:32 +00:00
border-bottom: 1px solid themed('navbar-border-bottom-color');
}
2019-11-04 13:09:44 +00:00
span {
@include themify($themes) {
background-color: themed('burger-menu-color');
2020-01-23 13:00:38 +00:00
}
2019-11-04 13:09:44 +00:00
border-radius: 1rem;
display: block;
height: 2px;
left: calc(50% - 8px);
position: absolute;
transform-origin: center;
transition-duration: 86ms;
transition-property: background-color, opacity, transform;
transition-timing-function: ease-out;
z-index: z('navbar');
2019-11-04 13:09:44 +00:00
width: 16px;
&:nth-child(1) {
top: calc(50% - 6px);
}
&:nth-child(2) {
top: calc(50% - 1px);
}
&:nth-child(3) {
top: calc(50% + 4px);
}
}
2020-02-20 10:08:38 +00:00
@include on-event {
2019-11-04 13:09:44 +00:00
span {
@include themify($themes) {
2020-02-20 10:08:38 +00:00
background-color: themed('navbar-title-hover-color');
2019-11-04 13:09:44 +00:00
}
}
}
&.is-active {
display: block;
span {
&:nth-child(1) {
transform: translateY(5px) rotate(45deg);
}
&:nth-child(2) {
opacity: 0;
}
&:nth-child(3) {
transform: translateY(-5px) rotate(-45deg);
}
}
}
2019-12-08 14:29:02 +00:00
}
2019-11-04 13:09:44 +00:00
}
&__logo {
width: 100%;
height: 100%;
&-link {
width: 40px;
height: 40px;
padding: 0.1rem;
margin: auto 0.25rem;
@include flex-shrink(0);
flex-shrink: 0;
}
}
&__long {
&-link {
width: 100%;
height: 100%;
padding: 0.6rem 0.2rem;
margin: auto 0.25rem;
@include flex-shrink(0);
flex-shrink: 0;
}
}
2019-11-04 13:09:44 +00:00
&__title {
2019-11-11 14:44:13 +00:00
height: $grid_navbar_height;
font-size: 1.5rem;
2020-01-29 15:02:49 +00:00
font-family: $title-font;
2020-01-26 10:59:22 +00:00
2019-11-04 13:09:44 +00:00
@include flexbox();
@include align-items(center);
2019-11-04 13:09:44 +00:00
&-link {
@include themify($themes) {
color: themed("navbar-title-color");
@include on-event {
text-decoration: none;
color: themed("navbar-title-color");
}
}
2019-11-04 13:09:44 +00:00
}
}
&__menu {
@include flex-grow(1);
@include flexbox();
@include align-items(center);
@include justify-content(flex-end);
2019-11-11 14:44:13 +00:00
height: $grid_navbar_height;
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
2019-11-04 13:09:44 +00:00
display: none;
2019-12-08 14:29:02 +00:00
}
2019-11-04 13:09:44 +00:00
&-item {
2020-02-20 10:08:38 +00:00
height: $grid_navbar_height;
2019-11-04 13:09:44 +00:00
padding: 0.5rem;
font-size: 1rem;
font-family: $title-font;
font-weight: 700;
2019-11-04 13:09:44 +00:00
@include flexbox();
@include align-items(center);
@include justify-content(center);
@include no-select;
2019-11-04 13:09:44 +00:00
@include themify($themes) {
2020-01-26 08:48:03 +00:00
color: themed('navbar-title-color');
border-top: 1px solid transparent;
border-bottom: 1px solid themed('navbar-border-bottom-color');
background-color: themed('navbar-background-color');
2019-11-04 13:09:44 +00:00
@include on-event {
color: themed('navbar-title-hover-color');
2020-02-20 10:08:38 +00:00
// background-color: themed('navbar-menu-hover-background-color');
2019-11-04 13:09:44 +00:00
text-decoration: none;
border-bottom: 1px solid themed('navbar-border-bottom-color');
}
@media only screen and (max-width: 769px) {
border-bottom: none;
2019-11-07 18:09:15 +00:00
}
&.active {
color: themed('navbar-title-active-color') !important;
2019-11-04 13:09:44 +00:00
}
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
2019-11-04 13:09:44 +00:00
@include justify-content(flex-start);
width: 100%;
padding: 0 0.75rem;
}
}
2020-02-20 10:08:38 +00:00
// &.is-active {
// position: absolute;
// top: $grid_navbar_height;
// left: 0;
// width: 100%;
// height: auto;
// overflow: hidden;
// @include flexbox();
// @include flex-direction(column);
// @include align-items(flex-start);
// @include themify($themes) {
// border-top: 1px solid themed('navbar-border-bottom-color');
// background-color: themed('navbar-mobile-background-color');
// border-bottom: 1px solid themed('navbar-border-bottom-color');
// }
// }
2019-11-04 13:09:44 +00:00
}
&__dropdown {
display: inline-block;
2019-11-11 14:44:13 +00:00
height: $grid_navbar_height;
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
2019-11-04 13:09:44 +00:00
width: 100%;
height: auto;
}
&--content {
position: absolute;
display: none;
width: inherit;
z-index: z("dropdown");
border-bottom-left-radius: 0.15rem;
border-bottom-right-radius: 0.15rem;
@include box-shadow(0, 1px, 3px, 0, rgba(0, 0, 0, 0.4));
@include themify($themes) {
border-top: 4px solid themed("dropdown-border-top-color");
background-color: themed("dropdown-content-background-color");
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
2019-11-04 13:09:44 +00:00
position: relative;
display: block;
box-shadow: none;
@include themify($themes) {
border-top: none;
background-color: themed("navbar-mobile-background-color");
2019-11-04 13:09:44 +00:00
}
2019-12-08 14:29:02 +00:00
}
2019-11-04 13:09:44 +00:00
}
&--item {
2020-02-20 14:08:34 +00:00
padding: 0.25rem 0.75rem;
2019-11-04 13:09:44 +00:00
height: auto;
margin: auto;
min-width: 40px;
max-width: 150px;
2019-11-04 13:09:44 +00:00
text-decoration: none;
display: block;
font-size: 1rem;
font-weight: 700;
2019-11-04 13:09:44 +00:00
@include truncate(150px);
2019-11-04 13:09:44 +00:00
@include themify($themes) {
color: themed("dropdown-item-color");
background-color: themed("navbar-background-color");
2019-11-04 13:09:44 +00:00
@include on-event {
color: themed("navbar-dropdown-item-hover-color");
background-color: themed("navbar-menu-hover-background-color");
text-decoration: none;
&:last-child {
border-bottom-left-radius: 0.15rem;
border-bottom-right-radius: 0.15rem;
}
}
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
padding: 0 2.5rem;
min-width: 100%;
max-width: 100%;
2019-11-04 13:09:44 +00:00
}
}
}
}
.navbar__dropdown:hover .navbar__dropdown--content {
display: block;
}
.theme {
@include flexbox();
@include align-items(center);
@include justify-content(flex-end);
&[data-ani="true"] {
@include animation('slide-in-down .5s .0s 1 ease both');
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
display: none;
}
2020-02-16 18:55:32 +00:00
.dropdown {
2020-02-20 10:08:38 +00:00
height: $grid_navbar_height !important;
2020-02-16 18:55:32 +00:00
position: relative;
@include flexbox();
@include align-items(center);
@include justify-content(center);
@include themify($themes) {
color: themed('burger-menu-color');
@include on-event {
color: themed('navbar-title-hover-color');
2020-02-20 14:08:34 +00:00
background-color: themed('navbar-background-color');
2020-02-20 10:08:38 +00:00
}
}
2020-01-26 10:59:22 +00:00
&-trigger {
padding: 0.5rem;
cursor: pointer;
border: none;
outline: none;
width: $grid_navbar_height;
height: $grid_navbar_height - 2px;
2020-02-20 10:08:38 +00:00
@include themify($themes) {
color: themed('burger-menu-color');
@include on-event {
color: themed('navbar-title-hover-color');
}
}
}
@media only screen and (max-width: 769px) {
&-trigger {
padding: 0.25rem;
width: 35px;
}
}
&-content {
position: absolute;
top: 100%;
right: 0;
display: none;
height: auto;
z-index: z("dropdown");
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
a {
font-size: 0.9rem;
}
@include box-shadow(0, 1px, 3px, 0, rgba(0, 0, 0, 0.4));
@include themify($themes) {
border-top: 4px solid themed("dropdown-border-top-color");
background-color: themed("dropdown-content-background-color");
}
.is-active {
@include themify($themes) {
background-color: themed("dropdown-item-active-background-color");
}
}
}
&-item {
padding: 0.25rem 0.75rem;
height: 100%;
text-decoration: none;
display: block;
font-size: 1rem;
@include no-select;
@include themify($themes) {
color: themed("dropdown-item-color");
@include on-event {
color: themed("dropdown-item-hover-color");
background-color: themed("dropdown-item-hover-background-color");
text-decoration: none;
&:last-child {
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
}
}
}
}
.dropdown:hover .dropdown-content {
display: block;
}
}
.theme-mobile {
display: none;
outline: none;
position: absolute;
top: 0;
right: 35px * 2;
width: 35px;
height: $grid_navbar_height;
cursor: pointer;
z-index: z('modal');
&[data-ani="true"] {
@include animation('slide-in-down .5s .4s 1 ease both');
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
@include flexbox();
}
2020-02-20 10:08:38 +00:00
.dropdown:hover .dropdown-content {
display: block;
}
}
2020-02-20 10:08:38 +00:00
.navbarm {
padding: 0 0.75rem;
height: 100%;
position: relative;
@include flexbox();
@include align-items(center);
2020-02-20 10:08:38 +00:00
&__menu {
height: 100%;
padding: 0 0.75rem;
2020-02-20 10:08:38 +00:00
@include flexbox();
&--term {
&[data-index="0"] {
@include themify($themes) {
border-top: 1px solid themed('search-border-outline-color');
}
}
}
2020-02-20 10:08:38 +00:00
&--item {
height: $grid-navbar-height;
& > a {
height: 100%;
font-family: $title-font;
2020-02-20 14:08:34 +00:00
font-size: 1rem;
font-weight: bold;
2020-02-20 10:08:38 +00:00
color: inherit;
text-decoration: none !important;
padding: 0 1rem;
2020-02-20 10:08:38 +00:00
@include flexbox();
@include align-items(center);
@include justify-content(flex-start);
}
& svg {
margin: auto 0.25rem;
}
2020-02-20 10:08:38 +00:00
@include themify($themes) {
color: themed('body-color');
&.active {
font-weight: bold;
color: themed('navbar-title-active-color');
}
2020-02-20 14:08:34 +00:00
@include on-event {
background-color: themed('navbar-menu-hover-background-color');
}
}
}
&--subitem {
height: 30px;
padding: 0 2.5rem;
& > a {
font-size: 0.9rem;
}
}
2020-02-20 10:08:38 +00:00
}
2020-02-20 10:08:38 +00:00
&__collapse {
width: 100%;
position: absolute;
top: $grid-navbar-height;
left: 0;
max-height: 0;
overflow: hidden;
2020-02-20 10:08:38 +00:00
@include transition(all, 0.15s, ease-out);
@include themify($themes) {
background-color: themed('navbar-background-color');
&[data-open="true"] {
border-bottom: 2px solid themed('navbar-border-bottom-color');
}
&[data-open="false"] {
border-bottom: none;
}
}
}
}