Skip to content

Commit

Permalink
fix: don't apply menu item styles to btn is inside menu
Browse files Browse the repository at this point in the history
  • Loading branch information
saadeghi committed Feb 13, 2024
1 parent f788ef9 commit ac60762
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/components/styled/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
content: "";
}
}
.menu :where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
.menu :where(li:not(.menu-title) > *:not(ul, details, .menu-title, .btn)),
.menu :where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply rounded-btn px-4 py-2 text-start transition duration-200 ease-out;
text-wrap: balance;
}

:where(.menu li:not(.menu-title):not(.disabled) > *:not(ul):not(details):not(.menu-title)),
:where(.menu li:not(.menu-title):not(.disabled) > details > summary:not(.menu-title)) {
&:not(summary):not(.active).focus,
&:not(summary):not(.active):focus,
&:is(summary):not(.active):focus-visible {
:where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)),
:where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)) {
&:not(summary, .active, .btn).focus,
&:not(summary, .active, .btn):focus,
&:is(summary):not(.active, .btn):focus-visible {
@apply bg-base-content/10 text-base-content cursor-pointer outline-none;
}
@media (hover: hover) {
&:not(.active):hover {
&:not(.active, .btn):hover {
@apply cursor-pointer outline-none;
@supports (color: oklch(0 0 0)) {
@apply bg-base-content/10;
Expand All @@ -36,8 +36,8 @@
}
}

.menu li > *:not(ul):not(.menu-title):not(details):active,
.menu li > *:not(ul):not(.menu-title):not(details).active,
.menu li > *:not(ul, .menu-title, details, .btn):active,
.menu li > *:not(ul, .menu-title, details, .btn).active,
.menu li > details > summary:active {
@apply bg-neutral text-neutral-content [@media(hover:hover)]:bg-neutral [@media(hover:hover)]:text-neutral-content;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/unstyled/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:where(li ul) {
@apply relative whitespace-nowrap;
}
:where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
:where(li:not(.menu-title) > *:not(ul, details, .menu-title, .btn)),
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply grid grid-flow-col content-start items-center gap-2;
grid-auto-columns: minmax(auto, max-content) auto max-content;
Expand Down
8 changes: 4 additions & 4 deletions src/utilities/styled/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

.menu-xs {
:where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
:where(li:not(.menu-title) > *:not(ul, details, .menu-title)),
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply rounded px-2 py-1 text-xs;
}
Expand All @@ -27,7 +27,7 @@
}
}
.menu-sm {
:where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
:where(li:not(.menu-title) > *:not(ul, details, .menu-title)),
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply rounded-btn px-3 py-1 text-sm;
}
Expand All @@ -36,7 +36,7 @@
}
}
.menu-md {
:where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
:where(li:not(.menu-title) > *:not(ul, details, .menu-title)),
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply rounded-btn px-4 py-2 text-sm;
}
Expand All @@ -45,7 +45,7 @@
}
}
.menu-lg {
:where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
:where(li:not(.menu-title) > *:not(ul, details, .menu-title)),
:where(li:not(.menu-title) > details > summary:not(.menu-title)) {
@apply rounded-btn px-6 py-3 text-lg;
}
Expand Down

0 comments on commit ac60762

Please sign in to comment.