@@ -6,9 +6,17 @@ import { CloseIcon, CollapseAllIcon, ExpandAllIcon } from '../../icons';
66import { PanelDragHandleIcon } from '../../icons/PanelDragHandle' ;
77import { useTheme } from '../../theme' ;
88import { 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' ;
1018
11- type PanelProps = {
19+ export type PanelProps = {
1220 isOpen : boolean ;
1321 children : React . ReactNode ;
1422 areAllExpanded ?: boolean ;
@@ -38,25 +46,7 @@ const Panel_: React.FC<PanelProps> = ({
3846 if ( ! isOpen ) return null ;
3947 return (
4048 < 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 } >
6050 < Resizable
6151 defaultSize = { { width : '18rem' , height : 'auto' } }
6252 onResize = { ( ) => {
@@ -86,37 +76,24 @@ const Panel_: React.FC<PanelProps> = ({
8676 </ Tooltip >
8777 ) }
8878 </ 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
10184 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 >
10986 < IconButton onClick = { handleClose } >
11087 < CloseIcon />
11188 </ IconButton >
112- </ div >
89+ </ HeaderContainer >
11390 </ DrawerHeader >
11491 </ div >
11592 < PanelBody className = "panel-body" > { children } </ PanelBody >
11693 </ ErrorBoundary >
11794 </ ResizableContent >
11895 </ Resizable >
119- </ Box >
96+ </ PanelContainer >
12097 </ Draggable >
12198 ) ;
12299} ;
0 commit comments