Skip to content

Commit

Permalink
feat: animate the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
DanWebb committed Oct 4, 2024
1 parent 9ee3f5c commit 7e26383
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
26 changes: 22 additions & 4 deletions src/components/control/d-sidebar-nav.webc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
d-sidebar-nav {
details {
border-block-end: var(--diamond-border);

@media (width >= 600px) {
margin-block-start: var(--diamond-spacing-fluid);
margin-block-start: var(--diamond-spacing-fluid);

@media (width < 600px) {
background: var(--color-blue-darker);
border-block-start: var(--diamond-border);
margin-block-start: calc(var(--diamond-border-width) * -1);
margin-inline: calc(var(--diamond-spacing) * -1);
padding-inline: var(--diamond-spacing);

@supports (interpolate-size: allow-keywords) {
interpolate-size: allow-keywords;
transition: height .5s var(--diamond-transition-timing);
height: calc(((var(--diamond-spacing-sm) * 2) + var(--diamond-font-size-lg)) * var(--diamond-font-line-height));

&[open] {
height: auto;
overflow: clip; /* Clip off contents while animating */
}
}
}
}

Expand All @@ -15,9 +31,11 @@
cursor: pointer;
display: inline-flex;
list-style: none;
padding-block: var(--diamond-spacing-sm);
padding: var(--diamond-spacing-sm) var(--diamond-spacing);
margin-inline: calc(var(--diamond-spacing) * -1);
font-size: var(--diamond-font-size-lg);
transition: color var(--diamond-transition);
user-select: none;

&::-webkit-details-marker {
display: none;
Expand Down
1 change: 1 addition & 0 deletions src/layouts/default.webc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<!--- Bundled base styles --->
<link rel="stylesheet" href="../../node_modules/@etchteam/diamond-ui/diamond-ui.css" webc:bucket="styles">
<link rel="stylesheet" href="../styles/reset.css" webc:bucket="styles">
<link rel="stylesheet" href="../styles/color.css" webc:bucket="styles">
<link rel="stylesheet" href="../styles/font.css" webc:bucket="styles">
<link rel="stylesheet" href="../styles/spacing.css" webc:bucket="styles">
Expand Down
4 changes: 0 additions & 4 deletions src/styles/base.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[hidden] {
display: none !important;
}

h1,
h2,
h3 {
Expand Down
4 changes: 4 additions & 0 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Custom elements don't respect the global hidden attribute */
[hidden] {
display: none !important;
}

0 comments on commit 7e26383

Please sign in to comment.