refactor: improve SCSS nesting structure

This commit is contained in:
Erzbir
2026-05-16 15:27:13 +08:00
parent f3002b58dc
commit be59fb0e06
19 changed files with 394 additions and 379 deletions
+28 -36
View File
@@ -15,7 +15,7 @@
margin: 0;
}
.navigation-menu__inner {
&-inner {
display: flex;
flex: 1;
flex-wrap: wrap;
@@ -31,20 +31,13 @@
justify-items: center;
padding: 0;
li {
> li {
width: 100%;
}
li:not(:last-of-type) {
margin-bottom: 0;
}
.navigation-menu__inner li {
margin: 0;
padding: 0;
}
.navigation-menu__inner > li a {
> li a {
display: block;
text-align: center;
white-space: normal;
@@ -52,30 +45,29 @@
word-break: break-word;
}
}
}
> li {
flex: 0 0 auto;
margin-bottom: calc(var(--size-theme-font) * 0.625);
white-space: nowrap;
.navigation-menu__inner > li {
flex: 0 0 auto;
margin-bottom: calc(var(--size-theme-font) * 0.625);
white-space: nowrap;
@media (max-width: $phone-max-width) {
margin: 0;
padding: calc(var(--size-theme-font) * 0.3125);
min-width: 0;
white-space: normal;
}
@media (max-width: $phone-max-width) {
margin: 0;
padding: calc(var(--size-theme-font) * 0.3125);
min-width: 0;
white-space: normal;
&:not(:last-of-type) {
margin-right: calc(var(--size-theme-font) * 1.25);
@media (max-width: $phone-max-width) {
margin-right: 0;
}
}
}
}
.navigation-menu__inner > li:not(:last-of-type) {
margin-right: calc(var(--size-theme-font) * 1.25);
@media (max-width: $phone-max-width) {
margin-right: 0;
}
}
.navigation-menu .spacer {
.spacer {
flex-grow: 1 !important;
}
@@ -97,7 +89,7 @@
}
}
.menu__trigger {
.menu-trigger {
all: unset;
cursor: pointer;
background-color: var(--color-theme-background) !important;
@@ -118,7 +110,7 @@
}
}
.menu__dropdown {
.menu-dropdown {
display: none;
flex-direction: column;
position: absolute;
@@ -137,15 +129,15 @@
}
}
.menu__dropdown > li {
.menu-dropdown > li {
flex: 0 0 auto;
}
.menu__dropdown > li:not(:last-of-type) {
.menu-dropdown > li:not(:last-of-type) {
margin-bottom: calc(var(--size-theme-font) * 0.625);
}
.menu__dropdown > li a {
.menu-dropdown > li a {
display: flex;
padding: calc(var(--size-theme-font) * 0.3125);
text-decoration: underline;
@@ -155,8 +147,8 @@
display: flex;
}
.sub-menu:hover .menu__dropdown,
.sub-menu:active .menu__dropdown {
.sub-menu:hover .menu-dropdown,
.sub-menu:active .menu-dropdown {
display: flex !important;
opacity: 1;
visibility: visible;