Skip to content

Commit 43ae578

Browse files
committed
Responsive design
1 parent b797230 commit 43ae578

File tree

3 files changed

+117
-4
lines changed

3 files changed

+117
-4
lines changed

gui/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
<body>
1717
<div id="app">
18+
<button id="menu-toggle" class="menu-toggle" aria-label="Toggle Sidebar">
19+
<span class="arrow-icon"></span>
20+
</button>
1821
<div id="ui-container">
1922
<header>
2023
<div class="logo-container">

gui/src/main.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,3 +1094,20 @@ document.getElementById('advanced-toggle')?.addEventListener('click', function (
10941094
}
10951095
}
10961096
});
1097+
1098+
// Mobile Menu Toggle Logic
1099+
const menuToggle = document.getElementById('menu-toggle');
1100+
const uiContainer = document.getElementById('ui-container');
1101+
1102+
menuToggle?.addEventListener('click', () => {
1103+
menuToggle.classList.toggle('open');
1104+
uiContainer?.classList.toggle('sidebar-open');
1105+
});
1106+
1107+
// Close sidebar when clicking outside (on canvas) if open
1108+
canvasContainer.addEventListener('click', () => {
1109+
if (uiContainer?.classList.contains('sidebar-open')) {
1110+
menuToggle?.classList.remove('open');
1111+
uiContainer.classList.remove('sidebar-open');
1112+
}
1113+
});

gui/src/style.css

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ body {
2121
#app {
2222
display: flex;
2323
height: 100vh;
24+
height: 100dvh;
25+
/* Dynamic viewport height for mobile */
2426
width: 100vw;
2527
}
2628

@@ -41,6 +43,10 @@ header {
4143

4244
.logo-container {
4345
margin-bottom: 0;
46+
display: flex;
47+
justify-content: center;
48+
align-items: center;
49+
width: 100%;
4450
}
4551

4652
.main-logo {
@@ -294,8 +300,95 @@ input:checked+.slider:before {
294300
transform: rotate(180deg);
295301
}
296302

297-
.collapsible-content {
298-
margin-top: 16px;
299-
overflow: hidden;
300-
transition: max-height 0.3s ease-out;
303+
304+
/* Menu Toggle Button (Arrow Bar) */
305+
/* Menu Toggle Button (Arrow Bar) */
306+
.menu-toggle {
307+
display: none;
308+
/* Hidden on desktop */
309+
position: fixed;
310+
top: 50%;
311+
left: 0;
312+
transform: translateY(-50%);
313+
width: 20px;
314+
/* Slimmer */
315+
height: 80px;
316+
/* Taller */
317+
background-color: var(--primary-bg);
318+
border: 1px solid var(--border-color);
319+
border-left: none;
320+
/* Attached to edge */
321+
border-top-right-radius: 12px;
322+
border-bottom-right-radius: 12px;
323+
cursor: pointer;
324+
z-index: 2000;
325+
/* Much higher z-index to be safe */
326+
padding: 0;
327+
align-items: center;
328+
justify-content: center;
329+
box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
330+
/* Stronger shadow */
331+
transition: left 0.3s ease-in-out;
332+
}
333+
334+
.arrow-icon {
335+
width: 0;
336+
height: 0;
337+
border-top: 6px solid transparent;
338+
border-bottom: 6px solid transparent;
339+
border-left: 8px solid var(--text-primary);
340+
transition: transform 0.3s ease;
341+
}
342+
343+
/* Open State (Arrow Points Left) */
344+
.menu-toggle.open {
345+
left: 280px;
346+
/* Moves with sidebar width */
347+
}
348+
349+
.menu-toggle.open .arrow-icon {
350+
transform: rotate(180deg);
351+
}
352+
353+
/* Responsive Design */
354+
@media (max-width: 768px) {
355+
356+
/* Sidebar becomes off-canvas */
357+
#ui-container {
358+
position: fixed;
359+
top: 0;
360+
left: 0;
361+
height: 100%;
362+
height: 100dvh;
363+
/* Mobile viewport fix */
364+
width: 280px;
365+
/* Slightly narrower on mobile */
366+
transform: translateX(-100%);
367+
transition: transform 0.3s ease-in-out;
368+
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
369+
z-index: 1000;
370+
/* Ensure sidebar is high */
371+
}
372+
373+
/* Show sidebar when open */
374+
#ui-container.sidebar-open {
375+
transform: translateX(0);
376+
}
377+
378+
/* IMPORTANT: Explicitly show the toggle on mobile */
379+
.menu-toggle {
380+
display: flex !important;
381+
}
382+
383+
/* Adjust Header Layout for Mobile */
384+
header {
385+
display: flex;
386+
justify-content: center;
387+
align-items: center;
388+
}
389+
390+
/* Logo scaling */
391+
.main-logo {
392+
max-width: 140px;
393+
}
301394
}

0 commit comments

Comments
 (0)