datat.fi/_sass/basically-basic/_sidebar.scss

178 lines
3.2 KiB
SCSS

/* ==========================================================================
Sidebar
========================================================================== */
.sidebar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 150;
pointer-events: none;
/* page overlay dimmer */
&::after {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: opacity 0.3s cubic-bezier(0, 0, 0.3, 1);
background: rgba($base-color, 0.5);
content: '';
opacity: 0;
pointer-events: none;
will-change: opacity;
}
li {
transform: translateX(-1rem);
transition: all 0.5s;
opacity: 0;
&.is--moved {
transform: translateX(0);
opacity: 1;
}
/* line hover effect */
a {
position: relative;
color: $base-color;
&::before {
display: block;
position: absolute;
top: 50%;
left: -3rem;
width: 0;
height: 1px;
transition: width 0.3s cubic-bezier(0, 0, 0.3, 1);
background-color: $base-color;
content: '';
}
&:hover {
color: $accent-color;
}
&:hover::before {
width: 2.5rem;
}
}
}
&.is--visible {
transform: translateX(0);
&::after {
opacity: 1;
pointer-events: auto;
}
> .inner {
transform: none;
box-shadow: 0 1em 5em 0 rgba(0, 0, 0, 0.125);
}
&.is--animatable > .inner {
transition: all 330ms ease-out;
}
}
&.is--animatable > .inner {
transition: all 130ms ease-in;
}
> .inner {
position: relative;
width: 100%;
max-width: $sidebar-width;
height: 100%;
padding: 1.5em;
transform: translateX(-1 * $sidebar-width);
background-color: $sidebar-background-color;
box-shadow: none;
z-index: 160;
will-change: transform;
overflow-x: hidden;
pointer-events: auto;
@include breakpoint($medium) {
padding: 3rem;
}
@include breakpoint($large) {
max-width: (1.5 * $sidebar-width);
transform: translateX(-1.5 * $sidebar-width);
}
}
.menu {
@include fluid-type($min-vw, $max-vw, 24px, 48px);
position: relative;
margin-bottom: 1.5rem;
padding-bottom: 0.5rem;
font-weight: bold;
line-height: 1;
a {
display: block;
}
/* divider line */
&::after {
position: absolute;
bottom: 0;
width: 1.5em;
height: 1px;
background-color: $base-color;
content: '';
}
li {
margin-bottom: 1.5rem;
}
}
.contact-list {
@include fluid-type($min-vw, $max-vw, 18px, 24px);
margin-top: 0.5rem;
padding-top: 0.5rem;
li:not(:last-child) {
margin-bottom: 0.5rem;
}
a {
display: block;
color: $base-color;
text-decoration: none;
}
}
}
.sidebar-toggle-wrapper {
position: fixed;
top: 0.675rem;
right: 0;
cursor: pointer;
z-index: 10000;
.toggle {
display: flex;
align-items: center;
color: inherit;
text-decoration: none;
}
}
.sidebar-toggle-label {
order: 2;
margin-left: 0.5rem;
font-weight: bold;
}