diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d7e4b..944c600 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Added component `ExerciseBoardSidebar` and its styling - Added component `ExerciseBoardSubheader` and its styling - Added warnings to notify users if they submit an incomplete diagram when doing the fill in the diagram exercise +- Added responsive components to diagram page - Changed the colour of `ComponentPieces` to be based on its placement in the diagram by the user, with sidebar pieces being a neutral colour ### Bug Fix diff --git a/app/diagram/page.module.css b/app/diagram/page.module.css index 96cf4b8..b3949d2 100644 --- a/app/diagram/page.module.css +++ b/app/diagram/page.module.css @@ -1,11 +1,30 @@ +.container { + display: flex; + flex-direction: column; + gap: 1.5rem; + min-width: 0; + overflow: visible; +} + .leftCol { flex: 1; - min-width: 0; /* ← lets it shrink below its content size */ + min-width: 0; padding-left: var(--space-6); padding-right: var(--space-6); overflow: hidden; } +.sidebar { + width: 100%; + flex-shrink: 0; + height: auto; + overflow: visible; +} + +.sidebarPaper { + height: 100%; +} + .eyebrow { margin-top: var(--space-8); margin-bottom: var(--space-2); @@ -29,3 +48,25 @@ margin: 0 auto var(--space-4); flex-shrink: 0; } + +@media (min-width: 900px) { + .container { + flex-direction: row; + align-items: stretch; + gap: 0; + overflow: hidden; + } + + .sidebar { + width: 25%; + height: calc(100vh - var(--navbar-height)); + overflow-x: auto; + overflow-y: hidden; + position: sticky; + top: var(--navbar-height); + } + + .sidebarPaper { + height: 100%; + } +} diff --git a/app/diagram/page.tsx b/app/diagram/page.tsx index f602140..4c1ee96 100644 --- a/app/diagram/page.tsx +++ b/app/diagram/page.tsx @@ -14,9 +14,9 @@ import styles from './page.module.css' export default function DiagramPage() { const [selectedId, setSelectedId] = useState(null) - return
+ return
{/* Left: diagram + legend */} -
+

DIAGRAM · COMPONENTS & LAYERS

Click any component to learn what it does.

@@ -28,8 +28,10 @@ export default function DiagramPage() {
{/* Right: component sidebar */} - - - +
+ + + +
} diff --git a/components/diagram/ComponentSidebar.module.css b/components/diagram/ComponentSidebar.module.css index bf59e79..9971b9e 100644 --- a/components/diagram/ComponentSidebar.module.css +++ b/components/diagram/ComponentSidebar.module.css @@ -77,3 +77,19 @@ width: 100%; min-width: 0; } + +@media (max-width: 900px) { + .sidebar { + height: auto; + min-height: 0; + overflow: visible; + padding: var(--space-6); + } + + .sidebarEmpty { + width: 100%; + height: auto; + min-height: 140px; + box-sizing: border-box; + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3b54cb2..e13777a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11006,4 +11006,4 @@ } } } -} +} \ No newline at end of file