1
1
import { Resizable } from 're-resizable' ;
2
2
import React from 'react' ;
3
3
import Draggable from 'react-draggable' ;
4
- import { Box , BoxProps , IconButton , Tooltip } from '../../base' ;
5
- import { CloseIcon , CollapseAllIcon , ExpandAllIcon } from '../../icons' ;
6
- import { PanelDragHandleIcon } from '../../icons/PanelDragHandle' ;
7
- import { useTheme } from '../../theme' ;
4
+ import { Box , BoxProps , Tooltip } from '../../base' ;
5
+ import { CloseIcon , CollapseAllIcon , ExpandAllIcon , FullScreenIcon } from '../../icons' ;
6
+ import { SistentThemeProviderWithoutBaseLine , useTheme } from '../../theme' ;
8
7
import { ErrorBoundary } from '../ErrorBoundary' ;
9
8
import {
9
+ CustomIconButton ,
10
10
DragHandle ,
11
11
DrawerHeader ,
12
12
HeaderActionsContainer ,
13
13
HeaderContainer ,
14
14
PanelBody ,
15
15
PanelContainer ,
16
+ PanelTitle ,
16
17
ResizableContent
17
18
} from './style' ;
18
19
@@ -30,6 +31,8 @@ export type PanelProps = {
30
31
top ?: string | number ;
31
32
bottom ?: string | number ;
32
33
} ;
34
+ minimizePanel ?: ( ) => void ;
35
+ title ?: string ;
33
36
} ;
34
37
35
38
const Panel_ : React . FC < PanelProps > = ( {
@@ -40,7 +43,9 @@ const Panel_: React.FC<PanelProps> = ({
40
43
toggleExpandAll,
41
44
handleClose,
42
45
intitialPosition,
43
- sx
46
+ sx,
47
+ minimizePanel,
48
+ title = 'Debug Panel'
44
49
} ) => {
45
50
const theme = useTheme ( ) ;
46
51
if ( ! isOpen ) return null ;
@@ -70,22 +75,26 @@ const Panel_: React.FC<PanelProps> = ({
70
75
< Box display = "flex" justifyContent = "flex-end" padding = "8px" >
71
76
{ toggleExpandAll && (
72
77
< Tooltip title = { areAllExpanded ? 'Collapse All' : 'Expand All' } >
73
- < IconButton onClick = { toggleExpandAll } >
78
+ < CustomIconButton onClick = { toggleExpandAll } >
74
79
{ areAllExpanded ? < CollapseAllIcon /> : < ExpandAllIcon /> }
75
- </ IconButton >
80
+ </ CustomIconButton >
76
81
</ Tooltip >
77
82
) }
78
83
</ Box >
79
- < DragHandle >
80
- < PanelDragHandleIcon />
81
- </ DragHandle >
84
+ < DragHandle />
82
85
< HeaderContainer >
83
86
< HeaderActionsContainer
84
87
id = { `${ id } -panel-header-actions-container` }
85
88
> </ HeaderActionsContainer >
86
- < IconButton onClick = { handleClose } >
87
- < CloseIcon />
88
- </ IconButton >
89
+ < PanelTitle > { title } </ PanelTitle >
90
+ { minimizePanel && (
91
+ < CustomIconButton onClick = { minimizePanel } >
92
+ < FullScreenIcon fill = { theme . palette . common . white } />
93
+ </ CustomIconButton >
94
+ ) }
95
+ < CustomIconButton onClick = { handleClose } >
96
+ < CloseIcon fill = { theme . palette . common . white } />
97
+ </ CustomIconButton >
89
98
</ HeaderContainer >
90
99
</ DrawerHeader >
91
100
</ div >
@@ -99,5 +108,9 @@ const Panel_: React.FC<PanelProps> = ({
99
108
} ;
100
109
101
110
export const Panel : React . FC < PanelProps > = ( { ...props } ) => {
102
- return < Panel_ { ...props } /> ;
111
+ return (
112
+ < SistentThemeProviderWithoutBaseLine >
113
+ < Panel_ { ...props } /> ;
114
+ </ SistentThemeProviderWithoutBaseLine >
115
+ ) ;
103
116
} ;
0 commit comments