Skip to content

Commit

Permalink
Merge pull request #26 from ReshetS/mobile-menu.css
Browse files Browse the repository at this point in the history
Mobile menu.css
  • Loading branch information
ReshetS authored Apr 14, 2024
2 parents 20b5118 + 45f35ac commit b84695c
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 36 deletions.
1 change: 1 addition & 0 deletions src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@import url('./reviews.css');
@import url('./your-order.css');
@import url('./footer.css');
@import url('./mobile-menu.css');

:root {
font-family: 'Inter Tight', sans-serif;
Expand Down
160 changes: 160 additions & 0 deletions src/css/mobile-menu.css
Original file line number Diff line number Diff line change
@@ -1 +1,161 @@
/* Styles for Mobile menu */
.backdrop {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
background-color: rgba(20, 20, 20, 0.4);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
visibility 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #7a3145;
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
transform: translateX(100%);
}

.backdrop.is-open {
opacity: 1;
visibility: visible;
pointer-events: auto;
}

.backdrop.is-open > .mobile-menu {
transform: translateX(0);
}

.modal {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
padding-bottom: 40px;
padding-top: 240px;
}

.modal-btn {
position: absolute;
top: 20px;
right: 20px;
background-color: transparent;
border: none;
padding: 0;
line-height: 0;
}

.modal-close-icon-mini {
stroke: #fbfbfb;
}

.modal-close-icon-big {
display: none;
}

.modal-menu {
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
flex-direction: column;
margin-left: auto;
margin-right: auto;
}

.modal-menu-item {
display: flex;
justify-content: center;
align-items: center;
border: 1px solid rgba(251, 251, 251, 0.4);
border-radius: 12px;
width: 115px;
height: 42px;
transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-menu-item:hover,
.modal-menu-item:focus {
background: #fbfbfb;
}

.modal-menu-item:hover > .modal-menu-link,
.modal-menu-item:focus > .modal-menu-link {
color: #7a3145;
}

.modal-menu-link {
font-weight: 500;
font-size: 14px;
line-height: 1.28571;
letter-spacing: -0.02em;
text-align: center;
color: #fbfbfb;
transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-menu-item-shop {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
border: 1px solid rgba(251, 251, 251, 0.2);
border-radius: 30px;
width: 155px;
height: 50px;
margin-top: auto;
}

.modal-menu-link-shop {
font-weight: 600;
font-size: 14px;
line-height: 1.28571;
letter-spacing: -0.01em;
text-transform: uppercase;
color: #fbfbfb;
}

.modal-menu-item-shop:hover,
.modal-menu-item-shop:focus {
background: #fbfbfb;
}

.modal-menu-item-shop:hover > .modal-menu-link-shop,
.modal-menu-item-shop:focus > .modal-menu-link-shop {
color: #7a3145;
}

@media screen and (min-width: 768px) and (max-width: 1279px) {
.mobile-menu {
width: 351px;
right: 0;
left: auto;
}

.modal-close-icon-mini {
display: none;
}

.modal-close-icon-big {
display: block;
stroke: #fbfbfb;
}
}

@media screen and (min-width: 1280px) {
.backdrop.is-open {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
}
89 changes: 53 additions & 36 deletions src/partials/mobile-menu.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,55 @@
<div class="mobile-menu">
<div class="modal">
<button type="button" class="modal-btn">
<svg
class="modal-close-icon-mini"
width="20"
height="20"
aria-label="close-icon"
onclick="closeMobileMenu()"
>
<use href="./img/icons.svg#miniX"></use>
</svg>
<svg
class="modal-close-icon-big"
width="24"
height="24"
aria-label="close-icon"
onclick="closeMobileMenu()"
>
<use href="./img/icons.svg#bigX"></use>
</svg>
</button>
<ul class="modal-menu">
<li class="modal-menu-item">
<a href="#how-it-works" class="modal-menu-link">how it works</a>
</li>
<li class="modal-menu-item">
<a href="#vegetables" class="modal-menu-link">vegetables</a>
</li>
<li class="modal-menu-item-shop">
<a href="#reviews" class="modal-menu-link">reviews</a>
</li>
<li class="">
<a href="#your-order" class="modal-menu-link-shop">shop now</a>
</li>
</ul>
<div class="backdrop" id="mobile-menu">
<div class="mobile-menu">
<div class="modal container">
<button type="button" class="modal-btn" onclick="closeMobileMenu()">
<svg
class="modal-close-icon-mini"
width="20"
height="20"
aria-label="close-icon"
>
<use href="./img/icons.svg#miniX"></use>
</svg>
<svg
class="modal-close-icon-big"
width="24"
height="24"
aria-label="close-icon"
>
<use href="./img/icons.svg#bigX"></use>
</svg>
</button>
<ul class="modal-menu">
<li class="modal-menu-item">
<a
href="#how-it-works"
class="modal-menu-link"
onclick="closeMobileMenu()"
>how it works</a
>
</li>
<li class="modal-menu-item">
<a
href="#vegetables"
class="modal-menu-link"
onclick="closeMobileMenu()"
>vegetables</a
>
</li>
<li class="modal-menu-item">
<a href="#reviews" class="modal-menu-link" onclick="closeMobileMenu()"
>reviews</a
>
</li>
<li class="modal-menu-item-shop">
<a
href="#your-order"
class="modal-menu-link-shop"
onclick="closeMobileMenu()"
>shop now</a
>
</li>
</ul>
</div>
</div>
</div>

0 comments on commit b84695c

Please sign in to comment.