Site-Web/resources/sass/_partials/_navigation.scss

196 lines
4.3 KiB
SCSS

//vars
$fg: #115FA2;
$pi: 3.14;
//config
$menu-items: 3;
$menu-items-always-open: 3;
$open-distance: 105px;
$opening-angle: $pi*2;
$hamburger-spacing: 10px;
$default-opacity: 0.70;
$ball-spacing: 72px;
%ball {
background: $fg;
border-radius: 100%;
width: 60px;
height: 60px;
margin-left: -20px;
position: absolute;
top: 20px;
color: white;
text-align: center;
line-height: 60px;
transform: translate3d(0, 0, 0);
transition: transform ease-out 200ms;
opacity: $default-opacity;
img {
width: 42px;
height: 42px;
margin: 9px;
}
}
%ball-hover {
opacity: 1;
}
.menu {
position: fixed;
top: 0;
right: 5px;
width: 100px;
height: 100vh;
box-sizing: border-box;
font-size: 20px;
text-align: center;
z-index: 1000;
.menu-open {
display: none;
}
.menu-item, .menu-item-always-open {
@extend %ball;
opacity: 0;
transition-timing-function: cubic-bezier(0.165, 0.840, 0.440, 1.000);
@for $i from 1 through $menu-items {
&:nth-child(#{$i+2}) {
transition-duration: 180ms;
}
}
}
@for $i from 1 through $menu-items-always-open {
.menu-item-always-open:nth-of-type(#{$i+3}) {
opacity: $default-opacity;
top: 20px + $ball-spacing*$i;
&:hover {
@extend %ball-hover;
}
}
}
.hamburger {
$width: 32px;
$height: 4px;
width: $width;
height: $height;
background: white;
display: block;
position: absolute;
top: 50%;
left: 50%;
margin-left: -$width/2;
margin-top: -$height/2;
transition: transform 200ms;
border-radius: 20px;
&:first-of-type {
transform: translate3d(0, -$hamburger-spacing, 0);
}
&:nth-of-type(2) {
transform: translate3d(0, 0, 0);
}
&:last-of-type {
transform: translate3d(0, $hamburger-spacing, 0);
}
}
.menu-open:checked + .menu-open-button {
.hamburger {
&:first-of-type {
transform: translate3d(0, 0, 0) rotate(45deg);
}
&:nth-of-type(2) {
transform: translate3d(0, 0, 0) scale(0.1, 1);
}
&:last-of-type {
transform: translate3d(0, 0, 0) rotate(-45deg);
}
}
}
.menu-open-button {
@extend %ball;
z-index: 2;
transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.275);
transition-duration: 400ms;
transform: scale(1.05, 1.05) translate3d(0, 0, 0);
cursor: pointer;
&:hover {
@extend %ball-hover;
transform: scale(1.1, 1.1) translate3d(0, 0, 0);
}
}
.menu-open:checked + .menu-open-button {
transition-timing-function: linear;
transition-duration: 200ms;
transform: scale(0.9, 0.9) translate3d(0, 0, 0);
}
.menu-open:checked ~ .menu-item, .menu-open:checked ~ .menu-item-always-open {
opacity: $default-opacity;
&:hover {
@extend %ball-hover;
}
}
.menu-open:checked ~ .menu-item {
@for $i from 1 through $menu-items {
&:nth-child(#{$i+2}) {
transition-duration: 90ms+(100ms*$i);
transform: translate3d(0, $ball-spacing*$i, 0);
}
}
}
.menu-open:checked ~ .menu-item-always-open {
transition-duration: 90ms+(100ms);
transform: translate3d(0, $ball-spacing*$menu-items, 0);
}
.language-icon {
font-weight: 800;
font-size: 1.6rem;
color: white;
text-decoration: none;
text-align: center;
}
.menu-item.has-tooltip-text {
span {
display: none;
background: $fg;
border-top-left-radius: 60px;
border-bottom-left-radius: 60px;
height: 60px;
position: absolute;
right: 30px;
padding: 0 35px 0 25px;
text-align: center;
white-space: nowrap;
line-height: 60px;
z-index:-1;
}
&:hover {
span {
display: block;
}
}
}
}