Skip to content

Commit 9bb1a4c

Browse files
committed
Fix bugs
1 parent fd5d5db commit 9bb1a4c

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.1.97",
3+
"version": "0.1.98",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [

src/components/ResizableLayout/ResizableComponents.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,41 +159,44 @@ export const ResizableRow = ({
159159
children: any[];
160160
}) => {
161161
const theme = useTheme();
162+
var components = children;
163+
var componentsBaseWidth = baseWidth;
164+
var componentsMaxWidth = maxWidth;
162165

163166
console.log("Before", children, baseWidth, maxWidth)
164167

165168
if (layout === "only-editor") {
166169
// Remove viewers == Remove last element
167-
children.pop();
168-
baseWidth.pop();
169-
maxWidth.pop();
170+
components.pop();
171+
componentsBaseWidth.pop();
172+
componentsMaxWidth.pop();
170173
}
171174

172175
if (layout === "only-viewers") {
173176
// Remove editors == Remove middle element
174-
children.splice(1, 1);
175-
baseWidth.splice(1, 1);
176-
maxWidth.splice(1, 1);
177+
components.splice(1, 1);
178+
componentsBaseWidth.splice(1, 1);
179+
componentsMaxWidth.splice(1, 1);
177180
}
178181

179182
if (!showExplorer) {
180183
// Remove explorers == Remove first element
181-
children = [...children.slice(0, 0), ...children.slice(1)];
182-
baseWidth.shift();
183-
maxWidth.shift();
184+
components = [...components.slice(0, 0), ...components.slice(1)];
185+
componentsBaseWidth.shift();
186+
componentsMaxWidth.shift();
184187
}
185188

186189
console.log("After", children, baseWidth, maxWidth)
187190

188-
if (children.length === 0) {
191+
if (components.length === 0) {
189192
return <>{splashIcon}</>;
190193
}
191194

192-
if (children.length === 1) {
195+
if (components.length === 1) {
193196
return (
194197
<StyledHorizContiner bgColor={theme.palette?.primary}>
195198
<StyledHorizFillerContiner bgColor={theme.palette?.primary}>
196-
{children[0]}
199+
{components[0]}
197200
</StyledHorizFillerContiner>
198201
</StyledHorizContiner>
199202
);
@@ -204,13 +207,13 @@ export const ResizableRow = ({
204207
id="styled-horiz-container"
205208
bgColor={theme.palette?.primary}
206209
>
207-
{children.slice(0, children.length - 1).map((comp, i) => (
208-
<ResizableHoriz width={baseWidth[i]} max={maxWidth[i]} snap={[0]}>
210+
{components.slice(0, components.length - 1).map((comp, i) => (
211+
<ResizableHoriz width={componentsBaseWidth[i]} max={componentsMaxWidth[i]} snap={[0]}>
209212
{comp}
210213
</ResizableHoriz>
211214
))}
212215
<StyledHorizFillerContiner bgColor={theme.palette?.primary}>
213-
{children[children.length - 1]}
216+
{components[components.length - 1]}
214217
</StyledHorizFillerContiner>
215218
</StyledHorizContiner>
216219
);

0 commit comments

Comments
 (0)