File tree Expand file tree Collapse file tree 3 files changed +68
-59
lines changed
redisinsight/ui/src/components/base/layout/resize/handle Expand file tree Collapse file tree 3 files changed +68
-59
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
22import {
3- PanelResizeHandle ,
4- PanelResizeHandleProps ,
5- } from 'react-resizable-panels'
6- import classNames from 'classnames'
7-
8- import styles from './styles.module.scss'
9-
10- interface ResizablePanelHandleProps extends PanelResizeHandleProps {
11- direction ?: 'horizontal' | 'vertical'
12- }
3+ HandleContainer ,
4+ Line ,
5+ ResizablePanelHandleProps ,
6+ StyledPanelResizeHandle ,
7+ } from './resizable-panel-handle.styles'
138
149const ResizablePanelHandle = ( {
1510 className,
1611 direction = 'vertical' ,
1712 ...rest
1813} : ResizablePanelHandleProps ) => (
19- < PanelResizeHandle
20- className = { classNames (
21- className ,
22- direction === 'vertical' ? styles . vertical : styles . horizontal ,
23- ) }
14+ < StyledPanelResizeHandle
15+ $direction = { direction }
16+ className = { className }
2417 { ...rest }
2518 >
26- < div
27- className = { classNames (
28- styles . handle ,
29- direction === 'vertical' ? styles . vertical : '' ,
30- ) }
31- >
32- < div className = { styles . line } />
33- < div className = { styles . line } />
34- </ div >
35- </ PanelResizeHandle >
19+ < HandleContainer $direction = { direction } >
20+ < Line />
21+ < Line />
22+ </ HandleContainer >
23+ </ StyledPanelResizeHandle >
3624)
3725
3826export default ResizablePanelHandle
Original file line number Diff line number Diff line change 1+ import {
2+ PanelResizeHandle ,
3+ PanelResizeHandleProps ,
4+ } from 'react-resizable-panels'
5+ import styled , { css } from 'styled-components'
6+
7+ export interface ResizablePanelHandleProps extends PanelResizeHandleProps {
8+ direction ?: 'horizontal' | 'vertical'
9+ }
10+
11+ export const StyledPanelResizeHandle = styled ( PanelResizeHandle ) < {
12+ $direction : 'horizontal' | 'vertical'
13+ } > `
14+ ${ ( { $direction } ) =>
15+ $direction === 'vertical'
16+ ? css `
17+ width: 16px;
18+ height: 100%;
19+ display: flex;
20+ flex-direction: column;
21+ justify-content: center;
22+ `
23+ : css `
24+ height: 16px;
25+ width: 100%;
26+ display: flex;
27+ flex-direction: row;
28+ justify-content: center;
29+ ` }
30+ `
31+
32+ export const HandleContainer = styled . div < {
33+ $direction : 'horizontal' | 'vertical'
34+ children ?: React . ReactNode
35+ } > `
36+ width: 16px;
37+ height: 16px;
38+ display: flex;
39+ flex-direction: column;
40+ justify-content: center;
41+ align-items: center;
42+ gap: 2px;
43+
44+ ${ ( { $direction } ) =>
45+ $direction === 'vertical' &&
46+ css `
47+ transform: rotate(90deg);
48+ ` }
49+ `
50+
51+ export const Line = styled . div `
52+ width: 12px;
53+ height: 1px;
54+ background-color: #343741;
55+ `
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments