fix: menu overflow in small screens

This commit is contained in:
Lorenzo D'Ianni 2022-10-27 21:17:37 +02:00 committed by GitHub
parent 4b65a376a3
commit 2666508143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 5 deletions

View File

@ -1,5 +1,12 @@
@import "variables";
@mixin up-to-mobile {
@media (max-width: #{$mobile-width - 1px}) {
@content;
}
}
@mixin tablet {
@media (min-width: #{$tablet-width}) and (max-width: #{$desktop-width - 1px}) {
@content;

View File

@ -14,6 +14,7 @@ $radius-lg: 8px;
$shadow-soft: 0 2px 10px 0 rgba(0, 0, 0, .03), 0 2px 20px 10px rgba(0, 0, 0, 0.02);
$mobile-width: 350px;
$tablet-width: 768px;
$desktop-width: 1024px;
@ -28,13 +29,14 @@ $main-background: $color-neutral-light;
$article-background: $color-neutral-light;
$article-offset-top: -$header-height + -$gap-sm;
$dropdown-padding: 12px 16px;
$dropdown-border-radius: $radius-md;
$dropdown-animation-timing: .4s;
$dropdown-label-padding: 12px 8px;
$dropdown-label-background-color: transparent;
$dropdown-arrow-size: 10px;
$dropdown-options-background-color: $color-neutral-light;
$dropdown-options-space-from-label: $gap-sm;
$dropdown-option-padding: 12px 16px;
$dropdown-option-border-bottom-color: rgba($color-neutral-dark, .04);
$banner-image-height: 300px;

View File

@ -21,7 +21,6 @@
.dropdown {
position: relative;
min-width: 110px;
&__label {
display: block;
@ -34,7 +33,7 @@
text-decoration: inherit;
text-transform: inherit;
text-align: center;
padding: $dropdown-padding;
padding: $dropdown-label-padding;
background-color: $dropdown-label-background-color;
border-radius: $dropdown-border-radius;
&:after {
@ -51,7 +50,8 @@
&__options {
visibility: visible;
min-width: 100%;
z-index: 1;
min-width: 110px;
max-height: 50vh;
position: absolute;
top: 100%;
@ -64,6 +64,11 @@
box-shadow: $shadow-soft;
overflow: auto;
animation: hide math.div($dropdown-animation-timing, 2) ease forwards;
@include up-to-mobile {
top: 75%;
}
&:before {
content: '';
width: 0;
@ -81,7 +86,7 @@
&__option {
a {
display: block;
padding: $dropdown-padding;
padding: $dropdown-option-padding;
color: rgba(black, .6);
text-decoration: none;
border-bottom: 1px solid $dropdown-option-border-bottom-color;

View File

@ -29,12 +29,36 @@
display: flex;
color: $color-neutral-light;
list-style: none;
margin-left: $gap-sm * 2;
}
&__menu-item {
margin-right: $gap-sm;
&:last-child {
margin-right: 0;
}
}
}
@include up-to-mobile {
.header {
.container {
align-items: flex-start;
height: auto;
margin-top: $gap-sm;
}
&__menu {
flex-direction: column;
justify-content: flex-end;
align-items: flex-end;
margin-top: $gap-sm * -1;
}
&__menu-item {
margin-right: 0;
}
}
}

View File

@ -37,6 +37,11 @@
&__title {
font-size: 2.6em;
margin-bottom: $gap-sm;
@include up-to-mobile {
word-break: break-all;
}
@include desktop {
width: 85%;
font-size: 3.6em;