|
@@ -1,10 +1,11 @@
|
|
|
-import React, { ReactNode, useEffect } from 'react'
|
|
|
|
|
|
|
+import React, { ReactNode, useEffect, useState } from 'react'
|
|
|
import { Panel, PanelGroup } from 'react-resizable-panels'
|
|
import { Panel, PanelGroup } from 'react-resizable-panels'
|
|
|
import { HorizontalResizeHandle } from '@/features/ide-react/components/resize/horizontal-resize-handle'
|
|
import { HorizontalResizeHandle } from '@/features/ide-react/components/resize/horizontal-resize-handle'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
import { HorizontalToggler } from '@/features/ide-react/components/resize/horizontal-toggler'
|
|
import { HorizontalToggler } from '@/features/ide-react/components/resize/horizontal-toggler'
|
|
|
import useFixedSizeColumn from '@/features/ide-react/hooks/use-fixed-size-column'
|
|
import useFixedSizeColumn from '@/features/ide-react/hooks/use-fixed-size-column'
|
|
|
import useCollapsiblePanel from '@/features/ide-react/hooks/use-collapsible-panel'
|
|
import useCollapsiblePanel from '@/features/ide-react/hooks/use-collapsible-panel'
|
|
|
|
|
+import classNames from 'classnames'
|
|
|
|
|
|
|
|
type TwoColumnMainContentProps = {
|
|
type TwoColumnMainContentProps = {
|
|
|
leftColumnId: string
|
|
leftColumnId: string
|
|
@@ -39,6 +40,8 @@ export default function TwoColumnMainContent({
|
|
|
|
|
|
|
|
useCollapsiblePanel(leftColumnIsOpen, leftColumnPanelRef)
|
|
useCollapsiblePanel(leftColumnIsOpen, leftColumnPanelRef)
|
|
|
|
|
|
|
|
|
|
+ const [resizing, setResizing] = useState(false)
|
|
|
|
|
+
|
|
|
// Update the left column default size on unmount rather than doing it on
|
|
// Update the left column default size on unmount rather than doing it on
|
|
|
// every resize, which causes ResizeObserver errors
|
|
// every resize, which causes ResizeObserver errors
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -54,6 +57,9 @@ export default function TwoColumnMainContent({
|
|
|
}
|
|
}
|
|
|
direction="horizontal"
|
|
direction="horizontal"
|
|
|
onLayout={handleLayout}
|
|
onLayout={handleLayout}
|
|
|
|
|
+ className={classNames({
|
|
|
|
|
+ 'ide-react-main-content-resizing': resizing,
|
|
|
|
|
+ })}
|
|
|
>
|
|
>
|
|
|
<Panel
|
|
<Panel
|
|
|
ref={leftColumnPanelRef}
|
|
ref={leftColumnPanelRef}
|
|
@@ -62,11 +68,12 @@ export default function TwoColumnMainContent({
|
|
|
collapsible
|
|
collapsible
|
|
|
onCollapse={collapsed => setLeftColumnIsOpen(!collapsed)}
|
|
onCollapse={collapsed => setLeftColumnIsOpen(!collapsed)}
|
|
|
>
|
|
>
|
|
|
- {leftColumnIsOpen ? leftColumnContent : null}
|
|
|
|
|
|
|
+ {leftColumnContent}
|
|
|
</Panel>
|
|
</Panel>
|
|
|
<HorizontalResizeHandle
|
|
<HorizontalResizeHandle
|
|
|
onDoubleClick={() => setLeftColumnIsOpen(!leftColumnIsOpen)}
|
|
onDoubleClick={() => setLeftColumnIsOpen(!leftColumnIsOpen)}
|
|
|
resizable={leftColumnIsOpen}
|
|
resizable={leftColumnIsOpen}
|
|
|
|
|
+ onDragging={setResizing}
|
|
|
>
|
|
>
|
|
|
<HorizontalToggler
|
|
<HorizontalToggler
|
|
|
id={leftColumnId}
|
|
id={leftColumnId}
|