Skip to content

Commit bf4657e

Browse files
committed
add wrappers around the resizable components
1 parent 8ee25d0 commit bf4657e

File tree

7 files changed

+55
-21
lines changed

7 files changed

+55
-21
lines changed
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
import HorizontalRule from './horizontal-rule/HorizontalRule'
22
import LoadingContent from './loading-content/LoadingContent'
3+
import ResizableContainer from './resize/container/ResizableContainer'
4+
import ResizablePanel from './resize/panel/ResizablePanel'
5+
import ResizablePanelHandle from './resize/handle/ResizablePanelHandle'
36

4-
export { HorizontalRule, LoadingContent }
7+
export {
8+
HorizontalRule,
9+
LoadingContent,
10+
ResizablePanel,
11+
ResizableContainer,
12+
ResizablePanelHandle,
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
import { PanelGroup, PanelGroupProps } from 'react-resizable-panels'
4+
5+
const ResizableContainer = (props: PanelGroupProps) => <PanelGroup {...props} />
6+
7+
export default ResizableContainer
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
3+
import {
4+
PanelResizeHandle,
5+
PanelResizeHandleProps,
6+
} from 'react-resizable-panels'
7+
8+
import styles from './styles.module.scss'
9+
10+
const ResizablePanelHandle = (props: PanelResizeHandleProps) => (
11+
<PanelResizeHandle className={styles.handle} {...props} />
12+
)
13+
14+
export default ResizablePanelHandle
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.handle {
2+
width: 16px;
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
import { Panel, PanelProps } from 'react-resizable-panels'
4+
5+
const ResizablePanel = (props: PanelProps) => <Panel {...props} />
6+
7+
export default ResizablePanel

redisinsight/ui/src/pages/browser/BrowserPage.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
22
import { useParams } from 'react-router-dom'
33
import { useDispatch, useSelector } from 'react-redux'
44
import cx from 'classnames'
5-
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels'
65
import { EuiButton } from '@elastic/eui'
76

87
import { isNumber } from 'lodash'
@@ -44,6 +43,7 @@ import {
4443
import OnboardingStartPopover from 'uiSrc/pages/browser/components/onboarding-start-popover'
4544
import { sidePanelsSelector } from 'uiSrc/slices/panels/sidePanels'
4645
import { useStateWithContext } from 'uiSrc/services/hooks'
46+
import { ResizableContainer, ResizablePanel, ResizablePanelHandle } from 'uiSrc/components/base/layout'
4747
import BrowserSearchPanel from './components/browser-search-panel'
4848
import BrowserLeftPanel from './components/browser-left-panel'
4949
import BrowserRightPanel from './components/browser-right-panel'
@@ -306,8 +306,8 @@ const BrowserPage = () => {
306306
/>
307307
</div>
308308
<div className={cx(styles.main)}>
309-
<PanelGroup className={styles.panelGroup} direction="horizontal" onLayout={onPanelWidthChange}>
310-
<Panel
309+
<ResizableContainer className={styles.resizableContainer} direction="horizontal" onLayout={onPanelWidthChange}>
310+
<ResizablePanel
311311
defaultSize={sizes && sizes[0] ? sizes[0] : 50}
312312
minSize={40}
313313
id={firstPanelId}
@@ -321,11 +321,11 @@ const BrowserPage = () => {
321321
removeSelectedKey={handleRemoveSelectedKey}
322322
handleAddKeyPanel={handleAddKeyPanel}
323323
/>
324-
</Panel>
324+
</ResizablePanel>
325325
{!arePanelsCollapsed && !isBrowserFullScreen && (
326-
<PanelResizeHandle className={styles.panelSeparator} />
326+
<ResizablePanelHandle />
327327
)}
328-
<Panel
328+
<ResizablePanel
329329
defaultSize={sizes && sizes[1] ? sizes[1] : 50}
330330
minSize={40}
331331
id={secondPanelId}
@@ -346,8 +346,8 @@ const BrowserPage = () => {
346346
handleBulkActionsPanel={handleBulkActionsPanel}
347347
closeRightPanels={closeRightPanels}
348348
/>
349-
</Panel>
350-
</PanelGroup>
349+
</ResizablePanel>
350+
</ResizableContainer>
351351
</div>
352352
<OnboardingStartPopover />
353353
</div >

redisinsight/ui/src/pages/browser/styles.module.scss

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,15 @@ $breakpoint-to-hide-resize-panel: 1280px;
7474
}
7575
}
7676

77-
.panelGroup {
77+
.resizableContainer {
7878
position: relative;
7979

80-
.panel {
81-
.noVisible{
82-
visibility: hidden;
83-
}
84-
85-
.fullWidth {
86-
width: 100% !important;
87-
min-width: 100% !important;
88-
}
80+
.noVisible{
81+
visibility: hidden;
8982
}
9083

91-
.panelSeparator {
92-
width: 16px;
84+
.fullWidth {
85+
width: 100% !important;
86+
min-width: 100% !important;
9387
}
9488
}

0 commit comments

Comments
 (0)