@@ -6,9 +6,17 @@ import { CloseIcon, CollapseAllIcon, ExpandAllIcon } from '../../icons';
6
6
import { PanelDragHandleIcon } from '../../icons/PanelDragHandle' ;
7
7
import { useTheme } from '../../theme' ;
8
8
import { ErrorBoundary } from '../ErrorBoundary' ;
9
- import { DrawerHeader , PanelBody , ResizableContent } from './style' ;
9
+ import {
10
+ DragHandle ,
11
+ DrawerHeader ,
12
+ HeaderActionsContainer ,
13
+ HeaderContainer ,
14
+ PanelBody ,
15
+ PanelContainer ,
16
+ ResizableContent
17
+ } from './style' ;
10
18
11
- type PanelProps = {
19
+ export type PanelProps = {
12
20
isOpen : boolean ;
13
21
children : React . ReactNode ;
14
22
areAllExpanded ?: boolean ;
@@ -38,25 +46,7 @@ const Panel_: React.FC<PanelProps> = ({
38
46
if ( ! isOpen ) return null ;
39
47
return (
40
48
< Draggable handle = ".drag-handle" >
41
- < Box
42
- sx = { {
43
- borderRadius : '8px' ,
44
- overflow : 'hidden' ,
45
- flexShrink : 0 ,
46
- zIndex : 99999 ,
47
- position : 'absolute' ,
48
- backgroundColor : theme . palette . background . blur ?. light ,
49
- boxShadow : '0 4px 16px #05003812' ,
50
- maxHeight : '80%' ,
51
- display : 'flex' ,
52
- boxSizing : 'border-box' ,
53
- ...( intitialPosition || {
54
- top : '6rem' ,
55
- right : '2rem'
56
- } ) ,
57
- ...( sx || { } )
58
- } }
59
- >
49
+ < PanelContainer theme = { theme } intitialPosition = { intitialPosition } sx = { sx } >
60
50
< Resizable
61
51
defaultSize = { { width : '18rem' , height : 'auto' } }
62
52
onResize = { ( ) => {
@@ -86,37 +76,24 @@ const Panel_: React.FC<PanelProps> = ({
86
76
</ Tooltip >
87
77
) }
88
78
</ Box >
89
- < PanelDragHandleIcon
90
- style = { { marginTop : '-3rem' , position : 'absolute' , left : '50%' } }
91
- />
92
- < div
93
- style = { {
94
- display : 'flex' ,
95
- justifyContent : 'end' ,
96
- alignItems : 'center' ,
97
- flex : 1
98
- } }
99
- >
100
- < div
79
+ < DragHandle >
80
+ < PanelDragHandleIcon />
81
+ </ DragHandle >
82
+ < HeaderContainer >
83
+ < HeaderActionsContainer
101
84
id = { `${ id } -panel-header-actions-container` }
102
- style = { {
103
- display : 'flex' ,
104
- gap : '1rem' ,
105
- justifyContent : 'flex-end' ,
106
- alignItems : 'center'
107
- } }
108
- > </ div >
85
+ > </ HeaderActionsContainer >
109
86
< IconButton onClick = { handleClose } >
110
87
< CloseIcon />
111
88
</ IconButton >
112
- </ div >
89
+ </ HeaderContainer >
113
90
</ DrawerHeader >
114
91
</ div >
115
92
< PanelBody className = "panel-body" > { children } </ PanelBody >
116
93
</ ErrorBoundary >
117
94
</ ResizableContent >
118
95
</ Resizable >
119
- </ Box >
96
+ </ PanelContainer >
120
97
</ Draggable >
121
98
) ;
122
99
} ;
0 commit comments