Skip to content

Commit 9f176b1

Browse files
committed
Updated nav bar menu animation to smoother dropdown
1 parent a0808bb commit 9f176b1

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/components/Header.astro

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,15 @@ const currentPath = Astro.url.pathname;
145145
width: 40px;
146146
height: 40px;
147147
background: none;
148-
border: 1.5px solid var(--border);
148+
border: none;
149149
border-radius: 4px;
150150
cursor: pointer;
151151
color: var(--ink);
152-
transition: border-color 0.2s, background 0.2s;
152+
transition: background 0.2s;
153153
flex-shrink: 0;
154154
}
155155

156156
.menu-toggle:hover {
157-
border-color: var(--ink);
158157
background: rgba(13, 15, 20, 0.04);
159158
}
160159

@@ -194,11 +193,11 @@ const currentPath = Astro.url.pathname;
194193

195194
nav.open {
196195
display: flex;
197-
animation: slideDown 0.2s ease both;
196+
animation: menuSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
198197
}
199198

200-
@keyframes slideDown {
201-
from { opacity: 0; transform: translateY(-8px); }
199+
@keyframes menuSlide {
200+
from { opacity: 0; transform: translateY(-6px); }
202201
to { opacity: 1; transform: translateY(0); }
203202
}
204203

@@ -208,6 +207,22 @@ const currentPath = Astro.url.pathname;
208207
font-size: 0.95rem;
209208
letter-spacing: 0.06em;
210209
color: rgba(255, 255, 255, 0.85);
210+
opacity: 0;
211+
transform: translateX(-8px);
212+
transition: background 0.2s, color 0.2s;
213+
}
214+
215+
nav.open a {
216+
animation: itemSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
217+
}
218+
219+
nav.open a:nth-child(1) { animation-delay: 0.06s; }
220+
nav.open a:nth-child(2) { animation-delay: 0.12s; }
221+
nav.open a:nth-child(3) { animation-delay: 0.18s; }
222+
223+
@keyframes itemSlide {
224+
from { opacity: 0; transform: translateX(-8px); }
225+
to { opacity: 1; transform: translateX(0); }
211226
}
212227

213228
nav a::after { display: none; }

0 commit comments

Comments
 (0)