add toggle behaviour
This commit is contained in:
@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<aside :class="{ 'navbar-dark': darkMode, 'navbar-light': !darkMode }">
|
<aside :class="[darkMode ? 'navbar-dark' : 'navbar-light', isExpanded ? 'is-expanded' : 'is-not-expanded']" >
|
||||||
<div class="toggle">
|
<div class="toggle">
|
||||||
<div :class="{ 'darkStylesIcon': darkMode, 'lightStylesIcon': !darkMode }" id="back-icon">
|
<div v-if="isExpanded" :class="{ 'darkStylesIcon': darkMode, 'lightStylesIcon': !darkMode }" id="back-icon">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy" src="../icons/Back-Icon.svg" />
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy" src="../icons/Back-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="{ 'darkStylesIcon': darkMode, 'lightStylesIcon': !darkMode }" id="indicator-icon">
|
<div :class="{ 'darkStylesIcon': darkMode, 'lightStylesIcon': !darkMode }" id="indicator-icon" @click="toggleSidebar">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="[darkMode ? darkStylesImg : lightStylesImg ]"
|
||||||
|
loading="lazy"
|
||||||
src="../icons/navbar-icons/Nav-Indicator-Icon-Opened.svg" />
|
src="../icons/navbar-icons/Nav-Indicator-Icon-Opened.svg" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Home-Icon.svg" />
|
src="../icons/navbar-icons/Home-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Home</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Home</pre>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<nav id="site-menu">
|
<nav id="site-menu">
|
||||||
@ -25,35 +26,35 @@
|
|||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Checklists-Icon.svg" />
|
src="../icons/navbar-icons/Checklists-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Checklists</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Checklists</pre>
|
||||||
</button>
|
</button>
|
||||||
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="assets-button">
|
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="assets-button">
|
||||||
<div class="icon" id="assets-icon">
|
<div class="icon" id="assets-icon">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Assets-Icon.svg" />
|
src="../icons/navbar-icons/Assets-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Config Items</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Config Items</pre>
|
||||||
</button>
|
</button>
|
||||||
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="solutions-button">
|
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="solutions-button">
|
||||||
<div class="icon" id="solutions-icon">
|
<div class="icon" id="solutions-icon">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Solutions-Icon.svg" />
|
src="../icons/navbar-icons/Solutions-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Solutions</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Solutions</pre>
|
||||||
</button>
|
</button>
|
||||||
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="accounting-button">
|
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="accounting-button">
|
||||||
<div class="icon" id="accounting-icon">
|
<div class="icon" id="accounting-icon">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Accounting-Icon.svg" />
|
src="../icons/navbar-icons/Accounting-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Accounting</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Accounting</pre>
|
||||||
</button>
|
</button>
|
||||||
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="clients-button">
|
<button :class="{ 'dark-menu': darkMode, 'light-menu': !darkMode }" id="clients-button">
|
||||||
<div class="icon" id="clients-icon">
|
<div class="icon" id="clients-icon">
|
||||||
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
<img :style="darkMode ? darkStylesImg : lightStylesImg" loading="lazy"
|
||||||
src="../icons/navbar-icons/Clients-Icon.svg" />
|
src="../icons/navbar-icons/Clients-Icon.svg" />
|
||||||
</div>
|
</div>
|
||||||
<pre :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Clients</pre>
|
<pre v-if="isExpanded" :style="darkMode ? darkStylesLabel : lightStylesLabel" class="label">Clients</pre>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@ -69,6 +70,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
darkMode: false,
|
darkMode: false,
|
||||||
|
isExpanded: true,
|
||||||
darkStylesImg: {
|
darkStylesImg: {
|
||||||
filter: 'invert(100%)',
|
filter: 'invert(100%)',
|
||||||
},
|
},
|
||||||
@ -83,6 +85,11 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
toggleSidebar() {
|
||||||
|
this.isExpanded = !this.isExpanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -94,14 +101,38 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aside {
|
||||||
|
transition: 0.2s ease-out;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: calc(2.5rem + 2.5rem);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.is-expanded {
|
||||||
|
width: 238px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-expanded .label {
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-not-expanded .darkStylesIcon {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-not-expanded .lightStylesIcon {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.navbar-dark {
|
.navbar-dark {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 200px;
|
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-width: 200px;
|
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
@ -113,11 +144,8 @@ export default {
|
|||||||
.navbar-light {
|
.navbar-light {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 200px;
|
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-width: 200px;
|
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
@ -140,8 +168,9 @@ export default {
|
|||||||
.menus {
|
.menus {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
position: relative;
|
||||||
justify-content: center;
|
transition: 0.2s ease-out;
|
||||||
|
justify-content: flex;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
}
|
}
|
||||||
@ -149,9 +178,9 @@ export default {
|
|||||||
nav {
|
nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 10px;
|
padding-top: 0.8rem;
|
||||||
|
padding-bottom: 0.8rem;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +221,7 @@ button {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightStylesIcon {
|
.lightStylesIcon {
|
||||||
@ -201,6 +231,7 @@ button {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.darkStylesIcon {
|
.darkStylesIcon {
|
||||||
@ -210,14 +241,23 @@ button {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#back-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 5px;
|
||||||
|
transition-duration: 0.5s;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#back-icon,
|
|
||||||
#indicator-icon {
|
#indicator-icon {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition-duration: 0.5s;
|
transition-duration: 0.5s;
|
||||||
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightStylesIcon:hover {
|
.lightStylesIcon:hover {
|
||||||
@ -236,6 +276,7 @@ button {
|
|||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
object-position: center;
|
object-position: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark-home-menu {
|
.dark-home-menu {
|
||||||
@ -252,5 +293,7 @@ button {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
font: 600 14px/20px Overpass, sans-serif;
|
font: 600 14px/20px Overpass, sans-serif;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s ease-out;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user