smoothed out navbar slide (unfinished)

This commit is contained in:
Johanna Kuehner
2024-02-23 21:58:32 +01:00
parent 8a77f18237
commit e4aa11b902
4 changed files with 216 additions and 230 deletions

View File

@ -1,67 +1,64 @@
<template>
<aside
:class="['navbar', darkMode ? 'navbar-darkmode' : 'navbar-lightmode', isExpanded ? 'is-expanded' : 'is-not-expanded']">
<aside :class="['navbar', darkMode ? 'navbar-darkmode' : 'navbar-lightmode', isExpanded ? 'is-expanded' : 'is-not-expanded']">
<div class="toggleNavbar">
<div v-if="isExpanded" :class="['icon', darkMode ? 'back-darkmode' : 'back-lightmode']" id="back-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/Back-Icon.svg" />
</div>
<div :class="['icon', darkMode ? 'indicator-darkmode' : 'indicator-lightmode']" id="indicator-icon"
@click="ToggleSidebar">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Nav-Indicator-Icon-Opened.svg" />
<div :class="['icon', darkMode ? 'indicator-darkmode' : 'indicator-lightmode']" id="indicator-icon" @click="ToggleSidebar">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Nav-Indicator-Icon-Opened.svg" />
</div>
</div>
<div class="menus">
<nav id="home-menu" :class="[darkMode ? 'menu-darkmode' : 'menu-lightmode']">
<router-link to="/home" class="button"
:class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="home-button">
<router-link to="/home" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="home-button">
<div class="icon" id="home-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Home-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Home-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Home</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Home</pre>
</Transition>
</router-link>
</nav>
<nav id="site-menu">
<router-link to="/maintenanceVisits" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
id="checklists-button">
<router-link to="/maintenanceVisits" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="checklists-button">
<div class="icon" id="checklists-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Checklists-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Checklists-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Checklists</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Checklists</pre>
</Transition>
</router-link>
<nuxt-link to="/assets" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" @click="defaultAssetPage()"
id="assets-button">
<nuxt-link to="/assets" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" @click="defaultAssetPage()" id="assets-button">
<div class="icon" id="assets-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Assets-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Assets-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Config Items</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Assets</pre>
</Transition>
</nuxt-link>
<router-link to="/solutions" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
id="solutions-button">
<router-link to="/solutions" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="solutions-button">
<div class="icon" id="solutions-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Solutions-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Solutions-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions</pre>
</Transition>
</router-link>
<router-link to="/issueSlips" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
id="accounting-button">
<router-link to="/issueSlips" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="accounting-button">
<div class="icon" id="accounting-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Accounting-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Accounting-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Accounting</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Accounting</pre>
</Transition>
</router-link>
<router-link to="/clients" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
id="clients-button">
<router-link to="/clients" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="clients-button">
<div class="icon" id="clients-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy"
src="../icons/navbar-icons/Clients-Icon.svg" />
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="../icons/navbar-icons/Clients-Icon.svg" />
</div>
<span v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Clients</span>
<Transition name="fade">
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Clients</pre>
</Transition>
</router-link>
</nav>
</div>
@ -102,47 +99,37 @@ export default {
box-sizing: border-box;
}
aside {
aside.navbar {
display: flex;
flex-direction: column;
position: sticky;
top: 5rem;
width: 3.125rem;
transition: 0.5s ease-in-out;
}
height: fit-content;
width: fit-content;
inline-size: fit-content;
border-radius: 0.625rem;
flex: 0 0 0;
align-items: stretch;
justify-content: center;
padding: 0.9375rem;
gap: 0.625rem;
overflow: clip;
overflow-clip-margin: 0.625rem;
}
aside.is-expanded {
width: 12.5rem;
}
.is-expanded .label {
opacity: 1;
transition: 0.5s ease-in-out;
}
animation: expand 0.5s linear both;
}
aside.is-not-expanded {
animation: contract 0.5s linear both;
}
.is-not-expanded #indicator-icon {
transform: rotate(180deg);
transition: 0.5s ease-in-out;
}
.navbar {
display: flex;
flex-direction: column;
height: fit-content;
border-radius: 0.625rem;
align-items: stretch;
justify-content: center;
gap: 0.625rem;
padding: 0.9375rem;
margin: 0;
}
}
.navbar-darkmode {
box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
background-color: #2C2C2C;
}
}
.navbar-lightmode {
box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
background-color: #FFFFFF;
@ -155,75 +142,67 @@ aside.is-expanded {
height: 2.5rem;
align-items: center;
justify-content: space-between;
overflow: clip;
overflow-clip-margin: 0.625rem;
}
.menus {
display: flex;
flex-direction: column;
position: relative;
justify-content: flex;
padding: 1.25rem 0;
align-items: flex-start;
justify-content: center;
gap: 1.875rem;
transition: 0.5s ease-in-out;
align-items: center;
overflow: clip;
overflow-clip-margin: 0.625rem;
}
nav {
display: flex;
flex-direction: column;
justify-content: center;
align-self: stretch;
padding: 0.9375rem 0;
align-items: flex-start;
justify-content: center;
gap: 1.875rem;
width: 92%;
}
overflow: clip;
overflow-clip-margin: 0.625rem;
}
.menu-darkmode {
border-bottom: 0.0625rem solid #8E8E8E;
}
.menu-lightmode {
border-bottom: 0.0625rem solid #BABABA;
}
.menu-darkmode { border-bottom: 0.0625rem solid #8E8E8E; }
.menu-lightmode { border-bottom: 0.0625rem solid #BABABA; }
button,
.button,
a {
display: flex;
flex-direction: row;
align-self: stretch;
height: 2.1875rem;
border-radius: 0.3125rem;
border-radius: 0.625rem;
align-items: center;
justify-content: flex-start;
gap: 0.3125rem;
border: none;
transition: 0.5s ease-in-out;
text-decoration: none;
width: 100%;
}
.button-darkmode {
background-color: #2C2C2C;
}
.button-lightmode {
background-color: #FFFFFF;
}
transition: 0.2s ease-in-out;
overflow: clip;
overflow-clip-margin: 0.625rem;
}
.button-darkmode { background-color: #2C2C2C; }
.button-lightmode { background-color: #FFFFFF; }
.button-darkmode:hover,
.indicator-darkmode:hover,
.back-darkmode:hover {
background-color: #444444;
}
.back-darkmode:hover { background-color: #444444; }
.button-lightmode:hover,
.indicator-lightmode:hover,
.back-lightmode:hover {
background-color: #ACACAC;
}
.back-lightmode:hover { background-color: #ACACAC; }
.is-not-expanded>button { align-self: center; }
.icon {
display: flex;
@ -232,24 +211,18 @@ a {
height: 2.1875rem;
align-items: center;
justify-content: center;
transition: 0.2s ease-in-out;
}
}
#back-icon,
#indicator-icon {
width: 2.5rem;
height: 2.5rem;
border-radius: 0.3125rem;
transition-duration: 0.5s;
transition: 0.2s ease-out;
}
transition: 0.2s ease-in-out;
}
.back-darkmode:hover,
.back-lightmode:hover,
.indicator-darkmode:hover,
.indicator-lightmode:hover {
cursor: pointer;
}
.indicator-lightmode:hover { cursor: pointer; }
img {
@ -258,28 +231,95 @@ img {
object-fit: contain;
object-position: center;
overflow: hidden;
transition: 0.2s ease-out;
}
}
.img-darkmode { filter: invert(100%); }
.img-darkmode {
filter: invert(100%);
}
.label {
letter-spacing: 5%;
display: inline-flex;
min-width: 0;
padding: 0rem 0.625rem 0rem 0.3125rem;
align-self: center;
letter-spacing: 0.03rem;
white-space: nowrap;
margin: auto 0;
font: 600 0.875rem/1.25rem Overpass, sans-serif;
}
.label-darkmode { color: #FFFFFF; }
.label-lightmode { color: #000000; }
.fade-enter-from,
.fade-leave-to {
opacity: 0;
transition: opacity 0.5s ease-out;
padding: 0;
}
.label-darkmode {
color: #FFFFFF;
.fade-enter-to,
.fade-leave-from {
opacity: 1;
padding: 0rem 0.625rem 0rem 0.3125rem;
}
.label-lightmode {
color: #000000;
.fade-enter-active {
transition: all 0.75s linear;
animation: fade-in 0.5s linear forwards;
}
.fade-leave-active {
transition: all 0.75s linear;
animation: fade-out 0.5s linear forwards;
}
.fade-move {
transition: transform 5s
}
@keyframes expand {
from {
max-inline-size: 4.0625rem;
max-width: 4.0625rem;
}
to {
max-inline-size: 15rem;
max-width: 15rem;
}
}
@keyframes contract {
from {
max-inline-size: 15rem;
max-width: 15rem;
}
to {
max-inline-size: 4.0625rem;
max-width: 4.0625rem;
}
}
@keyframes fade-in {
from {
max-width: 0;
max-inline-size: 0;
}
to {
max-width: 10rem;
width: fit-content;
}
}
@keyframes fade-out {
from {
max-width: 10rem;
width: fit-content;
}
to {
max-width: 0;
max-inline-size: 0;
}
}
</style>