Skip to content

Commit fed9d21

Browse files
chore: remove theme provider from panel
Signed-off-by: Vidit Kushwaha <viditkushwaha530@gmail.com>
1 parent 82a9982 commit fed9d21

1 file changed

Lines changed: 58 additions & 61 deletions

File tree

src/custom/Panel/Panel.tsx

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import Draggable from 'react-draggable';
44
import { Box, BoxProps, Tooltip } from '../../base';
55
import { CloseIcon, CollapseAllIcon, ExpandAllIcon, FullScreenIcon } from '../../icons';
6-
import { SistentThemeProviderWithoutBaseLine, useTheme } from '../../theme';
6+
import { useTheme } from '../../theme';
77
import { ErrorBoundary } from '../ErrorBoundary';
88
import {
99
CustomIconButton,
@@ -53,70 +53,67 @@ const Panel_: React.FC<PanelProps> = ({
5353
title = ''
5454
}) => {
5555
const theme = useTheme();
56-
const mode = theme.palette.mode;
5756
if (!isOpen) return null;
5857
return (
59-
<SistentThemeProviderWithoutBaseLine initialMode={mode}>
60-
<Draggable handle=".drag-handle">
61-
<PanelContainer theme={theme} intitialPosition={intitialPosition} sx={sx}>
62-
<Resizable
63-
defaultSize={{
64-
width: defaultSize?.width || '18rem',
65-
height: defaultSize?.height || 'auto'
66-
}}
67-
onResize={() => {
68-
window.dispatchEvent(new Event('panel-resize'));
69-
}}
70-
enable={{
71-
top: true,
72-
right: true,
73-
bottom: true,
74-
left: true,
75-
topRight: true,
76-
bottomRight: true,
77-
bottomLeft: true,
78-
topLeft: true
79-
}}
80-
>
81-
<ResizableContent>
82-
<ErrorBoundary>
83-
<div className="drag-handle">
84-
<DrawerHeader>
85-
<Box display="flex" justifyContent="flex-end" padding="8px">
86-
{toggleExpandAll && (
87-
<Tooltip title={areAllExpanded ? 'Collapse All' : 'Expand All'}>
88-
<CustomIconButton onClick={toggleExpandAll}>
89-
{areAllExpanded ? <CollapseAllIcon /> : <ExpandAllIcon />}
90-
</CustomIconButton>
91-
</Tooltip>
92-
)}
93-
</Box>
94-
<DragHandle />
95-
<HeaderContainer>
96-
<HeaderActionsContainer
97-
id={`${id}-panel-header-actions-container`}
98-
></HeaderActionsContainer>
99-
<PanelTitle>{title}</PanelTitle>
100-
{minimizePanel && (
101-
<CustomIconButton onClick={minimizePanel}>
102-
<FullScreenIcon fill={theme.palette.common.white} />
58+
<Draggable handle=".drag-handle">
59+
<PanelContainer theme={theme} intitialPosition={intitialPosition} sx={sx}>
60+
<Resizable
61+
defaultSize={{
62+
width: defaultSize?.width || '18rem',
63+
height: defaultSize?.height || 'auto'
64+
}}
65+
onResize={() => {
66+
window.dispatchEvent(new Event('panel-resize'));
67+
}}
68+
enable={{
69+
top: true,
70+
right: true,
71+
bottom: true,
72+
left: true,
73+
topRight: true,
74+
bottomRight: true,
75+
bottomLeft: true,
76+
topLeft: true
77+
}}
78+
>
79+
<ResizableContent>
80+
<ErrorBoundary>
81+
<div className="drag-handle">
82+
<DrawerHeader>
83+
<Box display="flex" justifyContent="flex-end" padding="8px">
84+
{toggleExpandAll && (
85+
<Tooltip title={areAllExpanded ? 'Collapse All' : 'Expand All'}>
86+
<CustomIconButton onClick={toggleExpandAll}>
87+
{areAllExpanded ? <CollapseAllIcon /> : <ExpandAllIcon />}
10388
</CustomIconButton>
104-
)}
105-
<CustomIconButton onClick={handleClose}>
106-
<CloseIcon fill={theme.palette.common.white} />
89+
</Tooltip>
90+
)}
91+
</Box>
92+
<DragHandle />
93+
<HeaderContainer>
94+
<HeaderActionsContainer
95+
id={`${id}-panel-header-actions-container`}
96+
></HeaderActionsContainer>
97+
<PanelTitle>{title}</PanelTitle>
98+
{minimizePanel && (
99+
<CustomIconButton onClick={minimizePanel}>
100+
<FullScreenIcon fill={theme.palette.common.white} />
107101
</CustomIconButton>
108-
</HeaderContainer>
109-
</DrawerHeader>
110-
</div>
111-
<PanelBody className="panel-body" theme={theme}>
112-
{children}
113-
</PanelBody>
114-
</ErrorBoundary>
115-
</ResizableContent>
116-
</Resizable>
117-
</PanelContainer>
118-
</Draggable>
119-
</SistentThemeProviderWithoutBaseLine>
102+
)}
103+
<CustomIconButton onClick={handleClose}>
104+
<CloseIcon fill={theme.palette.common.white} />
105+
</CustomIconButton>
106+
</HeaderContainer>
107+
</DrawerHeader>
108+
</div>
109+
<PanelBody className="panel-body" theme={theme}>
110+
{children}
111+
</PanelBody>
112+
</ErrorBoundary>
113+
</ResizableContent>
114+
</Resizable>
115+
</PanelContainer>
116+
</Draggable>
120117
);
121118
};
122119

0 commit comments

Comments
 (0)