Added responsive side menu

Made filters div with collapse
This commit is contained in:
ericb 2024-11-26 16:15:04 +01:00
parent 1cbde50ab8
commit 9ca385c99a
6 changed files with 227 additions and 168 deletions

View file

@ -52,6 +52,12 @@ body {
#mainNav, .offcanvas-backdrop{
top: var(--top-bar);
}
.offcanvas-header, .offcanvas-body{
padding: 1.625rem;
}
.offcanvas.offcanvas-end{
border-left: none;
}
.wrapper {
display: flex;
align-items: center;
@ -64,21 +70,33 @@ body {
[data-screen="404"] .container{
justify-content: center;
}
[data-screen="search"] .container-fluid > .row{
justify-content: center;
}
/* side menu */
.side-menu{
}
.side-menu li{
background: white;
.side-menu .nav-item{
position: relative;
}
.side-menu .nav-link{
color: black;
padding: 0.725rem 1rem;
border-radius: 0.25rem;
background: white;
border-left: 0px solid #f28705;
transition: all ease-in 0.25s;
}
.side-menu .nav-link:active, .side-menu .nav-link.active{
background-color: #f28705;
font-weight: 700;
pointer-events: none;
cursor: default;
}
.side-menu .nav-link:not(.active):hover{
color: black;
background: #fdc314;
border-left: 6px solid #f28705;
transition: all ease-in 0.25s;
}
.side-menu .nav-link:focus{
color: black;
@ -88,6 +106,13 @@ body {
.side-menu li:not(:first-child){
margin-top: 0.35rem;
}
.menu-separator{
margin-top: 1.5rem;
border-bottom: 2px solid #f28705;
font-weight: 700;
margin-bottom: 0.5rem;
padding-bottom: 0.5rem;
}
/* heros */
.hero{
@ -228,6 +253,9 @@ article li:not(:first-of-type){
#search-filters{
border: 1px solid white;
background-color: var(--accent-light);
margin-top: 0.5rem;
}
#search-filters form{
padding: calc(var(--div-padding) / 3);
}
@ -332,6 +360,17 @@ footer a img{
max-height: 3em;
min-height: 2.5em;
}
.ui-btn{
padding: 1rem;
background-color: white;
width: fit-content;
border-radius: 0.5rem;
}
.icon-ui{
width: 1.5em;
height: 1.5em;
margin-right: 0.75rem;
}
/* media queries */
@media (width <= 576px) {
body{

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 512 512">
<defs>
<style>
.cls-1 {
fill: none;
stroke: #000;
stroke-linecap: round;
stroke-miterlimit: 133.3;
stroke-width: 50px;
}
</style>
</defs>
<g>
<g id="Calque_1">
<path class="cls-1" d="M78.2,100.4h133.3M211.6,100.4c0,24.5,19.9,44.4,44.4,44.4s44.4-19.9,44.4-44.4M211.6,100.4c0-24.5,19.9-44.4,44.4-44.4s44.4,19.9,44.4,44.4M300.4,100.4h133.3M78.2,256h266.7M344.9,256c0,24.5,19.9,44.4,44.4,44.4s44.4-19.9,44.4-44.4-19.9-44.4-44.4-44.4-44.4,19.9-44.4,44.4ZM167.1,411.6h266.7M167.1,411.6c0-24.5-19.9-44.4-44.4-44.4s-44.4,19.9-44.4,44.4,19.9,44.4,44.4,44.4,44.4-19.9,44.4-44.4Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 786 B

18
static/js/menu.js Normal file
View file

@ -0,0 +1,18 @@
document.addEventListener("DOMContentLoaded", function() {
const offmenu = document.getElementById("offSideMenu");
const sidemenu = document.getElementById("secondary-nav");
function toggleMenus(mediaQuery) {
if (!mediaQuery.matches) {
offmenu.style.display = "none";
sidemenu.style.display = "block";
} else {
offmenu.style.display = "block";
sidemenu.style.display = "none";
}
}
const mediaQuery = window.matchMedia("(max-width: 992px)");
toggleMenus(mediaQuery); // Initial check
mediaQuery.addEventListener('change', (e) => toggleMenus(e));
});