Centered burger menu

This commit is contained in:
Nik Afiq 2025-11-05 15:48:12 +09:00
parent 4d939838d1
commit 21e5b31471
2 changed files with 28 additions and 16 deletions

View File

@ -22,8 +22,12 @@ export default function App() {
<div className={`site ${open ? "sidebar-open" : ""}`}>
{/* Top-left header (outside the card) */}
<header className="site-header">
<button className="burger" aria-label="Menu" onClick={() => setOpen(v => !v)}>
<button className="burger" aria-label="メニュー" onClick={() => setOpen(v => !v)}>
<svg className="burger-icon" viewBox="0 0 24 24" width="22" height="22" aria-hidden="true">
<path d="M4 7h16M4 12h16M4 17h16"
stroke="currentColor" strokeWidth="2"
strokeLinecap="round" strokeLinejoin="round" fill="none" />
</svg>
</button>
<Link to="/" className="brand">Watch Party</Link>
</header>

View File

@ -28,11 +28,29 @@ html, body, #root {
display:flex; align-items:center; justify-content:space-between;
margin-bottom: 12px;
}
.burger {
font-size:20px; line-height:1; padding:6px 10px; border-radius:8px;
background: rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15);
color: var(--text); cursor:pointer;
/* Button container */
.burger{
display:grid; /* centers SVG */
place-items:center;
width:40px; height:40px; /* good touch target */
padding:0; line-height:0; /* no baseline artifacts */
border-radius:12px;
color:var(--text);
background:rgba(255,255,255,.08);
border:1px solid rgba(255,255,255,.15);
cursor:pointer;
}
/* SVG itself */
.burger-icon{
display:block;
shape-rendering:geometricPrecision;
}
/* polish */
.burger:hover{ background:rgba(255,255,255,.12); }
.burger:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.brand { color: var(--text); text-decoration:none; font-weight:800; }
.drawer {
position:absolute; left:16px; top:56px; display:flex; flex-direction:column;
@ -159,16 +177,6 @@ kbd {
height: var(--header-h);
}
.burger {
font-size: 20px;
line-height: 1;
padding: 8px 10px;
border-radius: 10px;
color: var(--text);
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.15);
cursor: pointer;
}
.brand {
font-weight: 900;
color: var(--text);