@@ -32,7 +32,9 @@ const { lesson, previousLesson, nextLesson } = Astro.props
3232 <!-- Content Panel -->
3333 <aside
3434 class =" relative flex flex-col min-h-[250px] bg-light-bg border border-stroke-color rounded-2xl overflow-hidden"
35- style =" flex: 1 1 0%; min-width: 50px;"
35+ style ={ lesson .data .editor === false
36+ ? " flex: 1 1 0%; min-width: 50px;"
37+ : " flex: 1 1 0%; min-width: 50px;" }
3638 data-panel =" left"
3739 >
3840 <div
@@ -64,7 +66,7 @@ const { lesson, previousLesson, nextLesson } = Astro.props
6466
6567 <!-- Vertical Resizer -->
6668 <div
67- class =" hidden lg: flex items-center justify-center w- 3 hover:w-4 transition-[width] duration-150 cursor-col-resize select-none"
69+ class ={ ` flex items-center justify-center h-full ${ lesson . data . editor === false ? " cursor-not-allowed w-4 " : " w- 3 hover:w-4 transition-[width] duration-150 cursor-col-resize select-none" } ` }
6870 data-direction =" vertical"
6971 role =" separator"
7072 aria-orientation =" vertical"
@@ -74,8 +76,10 @@ const { lesson, previousLesson, nextLesson } = Astro.props
7476
7577 <!-- Editor Panel -->
7678 <section
77- class =" relative flex flex-col min-h-[250px] bg-light-bg border border-stroke-color rounded-2xl overflow-hidden"
78- style =" flex: 1 1 0%; min-width: 50px;"
79+ class ={ ` relative flex flex-col min-h-[250px] bg-light-bg border border-stroke-color rounded-2xl overflow-hidden ${lesson .data .editor === false ? " collapsed" : " " } ` }
80+ style ={ lesson .data .editor === false
81+ ? " flex: 0 0 50px; min-width: 50px;"
82+ : " flex: 1 1 0%; min-width: 50px;" }
7983 data-panel =" right"
8084 >
8185 <div
@@ -128,15 +132,21 @@ const { lesson, previousLesson, nextLesson } = Astro.props
128132 if (resizer.dataset.direction === "vertical" && window.innerWidth < 1024)
129133 return;
130134
135+ // Check if editor is disabled by looking for collapsed class on right panel
136+ const container = resizer.parentElement!;
137+ const rightPanel = container.querySelector<HTMLElement>(
138+ "[data-panel='right']",
139+ )!;
140+ if (rightPanel.classList.contains("collapsed")) return;
141+
131142 e.preventDefault();
132143 document.body.classList.add("is-resizing");
133144
134145 const isVertical = resizer.dataset.direction === "vertical";
135- const container = resizer.parentElement!;
136146 const leftPanel = container.querySelector<HTMLElement>(
137147 isVertical ? "[data-panel='left']" : "[data-editor-wrapper]",
138148 )!;
139- const rightPanel = container.querySelector<HTMLElement>(
149+ const rightPanelForResize = container.querySelector<HTMLElement>(
140150 isVertical ? "[data-panel='right']" : "[data-terminal]",
141151 )!;
142152
@@ -167,17 +177,20 @@ const { lesson, previousLesson, nextLesson } = Astro.props
167177 : collapsed === "right"
168178 ? "1 1 0%"
169179 : `${ratio} 1 0%`;
170- rightPanel .style.flex =
180+ rightPanelForResize .style.flex =
171181 collapsed === "left"
172182 ? "1 1 0%"
173183 : collapsed === "right"
174184 ? "0 0 50px"
175185 : `${1 - ratio} 1 0%`;
176186 leftPanel.classList.toggle("collapsed", collapsed === "left");
177- rightPanel.classList.toggle("collapsed", collapsed === "right");
187+ rightPanelForResize.classList.toggle(
188+ "collapsed",
189+ collapsed === "right",
190+ );
178191 } else {
179192 leftPanel.style.height = `${leftSize}px`;
180- rightPanel .style.height = `${rightSize}px`;
193+ rightPanelForResize .style.height = `${rightSize}px`;
181194 }
182195 };
183196
0 commit comments