Skip to content

Commit 32a3bc8

Browse files
authored
chore: remove unused code (#574)
1 parent 3bd8f6e commit 32a3bc8

File tree

7 files changed

+13
-103
lines changed

7 files changed

+13
-103
lines changed

src/app-layout/index.tsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { applyDefaults } from './defaults';
1010
import { AppLayoutProps } from './interfaces';
1111
import { Notifications } from './notifications';
1212
import { MobileToolbar } from './mobile-toolbar';
13-
import { SplitPanelWrapper } from './split-panel-wrapper';
1413
import { useFocusControl } from './utils/use-focus-control';
1514
import useWindowWidth from './utils/use-window-width';
1615
import useContentHeight from './utils/use-content-height';
@@ -21,7 +20,11 @@ import { AppLayoutContext } from '../internal/context/app-layout-context';
2120
import { useContainerQuery } from '../internal/hooks/container-queries';
2221
import { useStableEventHandler } from '../internal/hooks/use-stable-event-handler';
2322
import { applyDisplayName } from '../internal/utils/apply-display-name';
24-
import { SplitPanelContextProps, SplitPanelLastInteraction } from '../internal/context/split-panel-context';
23+
import {
24+
SplitPanelContext,
25+
SplitPanelContextProps,
26+
SplitPanelLastInteraction,
27+
} from '../internal/context/split-panel-context';
2528
import {
2629
CONSTRAINED_MAIN_PANEL_MIN_HEIGHT,
2730
CONSTRAINED_PAGE_HEIGHT,
@@ -340,6 +343,9 @@ const OldAppLayout = React.forwardRef(
340343
onPreferencesChange: onSplitPanelPreferencesSet,
341344
reportSize: setSplitPanelReportedSize,
342345
};
346+
const splitPanelWrapped = splitPanel && (
347+
<SplitPanelContext.Provider value={splitPanelContext}>{splitPanel}</SplitPanelContext.Provider>
348+
);
343349

344350
const contentWrapperProps: ContentWrapperProps = {
345351
navigationPadding: navigationHide || !!navigationOpen,
@@ -551,13 +557,11 @@ const OldAppLayout = React.forwardRef(
551557
</div>
552558
</ContentWrapper>
553559
</div>
554-
{finalSplitPanePosition === 'bottom' && (
555-
<SplitPanelWrapper context={splitPanelContext}>{splitPanel}</SplitPanelWrapper>
556-
)}
560+
{finalSplitPanePosition === 'bottom' && splitPanelWrapped}
557561
</main>
558562

559563
<ToolsAndSplitPanel
560-
splitPanel={finalSplitPanePosition === 'side' ? splitPanel : undefined}
564+
splitPanel={finalSplitPanePosition === 'side' ? splitPanelWrapped : undefined}
561565
ariaLabels={ariaLabels}
562566
closedDrawerWidth={closedDrawerWidth}
563567
contentHeightStyle={contentHeightStyle}
@@ -570,7 +574,6 @@ const OldAppLayout = React.forwardRef(
570574
isMotionEnabled={isMotionEnabled}
571575
onToolsToggle={onToolsToggle}
572576
panelHeightStyle={panelHeightStyle}
573-
splitPanelContext={splitPanelContext}
574577
splitPanelOpen={splitPanelOpenOnTheSide}
575578
splitPanelReportedSize={splitPanelReportedSize}
576579
toggleRefs={toolsRefs}

src/app-layout/split-panel-wrapper.tsx

-17
This file was deleted.

src/app-layout/toggles/circular-button.tsx

-35
This file was deleted.

src/app-layout/toggles/styles.scss

-34
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,3 @@
1414
top: awsui.$size-vertical-panel-icon-offset;
1515
z-index: 1;
1616
}
17-
18-
.circular-toggle {
19-
cursor: pointer;
20-
border-radius: 50%;
21-
border: none;
22-
width: awsui.$space-layout-toggle-diameter;
23-
height: awsui.$space-layout-toggle-diameter;
24-
padding: 0 awsui.$space-s;
25-
background: awsui.$color-background-layout-toggle-default;
26-
color: awsui.$color-text-layout-toggle;
27-
box-shadow: awsui.$shadow-panel-toggle;
28-
&:focus {
29-
outline: none;
30-
}
31-
@include focus-visible.when-visible {
32-
@include styles.focus-highlight(3px);
33-
}
34-
&:hover {
35-
background: awsui.$color-background-layout-toggle-hover;
36-
}
37-
&:active {
38-
background: awsui.$color-background-layout-toggle-active;
39-
}
40-
&-selected {
41-
background: awsui.$color-background-layout-toggle-selected-default;
42-
color: awsui.$color-text-layout-toggle-selected;
43-
&:hover {
44-
background: awsui.$color-background-layout-toggle-selected-hover;
45-
}
46-
&:active {
47-
background: awsui.$color-background-layout-toggle-selected-active;
48-
}
49-
}
50-
}

src/app-layout/tools-and-split-panel.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import clsx from 'clsx';
44
import React from 'react';
55
import { DesktopDrawerProps, Drawer } from './drawer';
66
import { AppLayoutProps } from './interfaces';
7-
import { SplitPanelWrapper } from './split-panel-wrapper';
87
import useContentHeight from './utils/use-content-height';
98
import styles from './styles.css.js';
109
import testutilStyles from './test-classes/styles.css.js';
11-
import { SplitPanelContextProps } from '../internal/context/split-panel-context';
1210

1311
interface ToolsAndSplitPanelProps {
1412
toolsHide: boolean;
@@ -28,8 +26,7 @@ interface ToolsAndSplitPanelProps {
2826
contentHeightStyle: ReturnType<typeof useContentHeight>['contentHeightStyle'];
2927

3028
tools: React.ReactNode;
31-
splitPanel?: React.ReactNode;
32-
splitPanelContext: SplitPanelContextProps;
29+
splitPanel: React.ReactNode;
3330

3431
ariaLabels: AppLayoutProps['ariaLabels'];
3532

@@ -54,7 +51,6 @@ export function ToolsAndSplitPanel({
5451
onToolsToggle,
5552
panelHeightStyle,
5653
splitPanel,
57-
splitPanelContext,
5854
toggleRefs,
5955
onLoseToolsFocus,
6056
tools,
@@ -81,7 +77,7 @@ export function ToolsAndSplitPanel({
8177
...(isMobile ? { top: headerHeight, bottom: footerHeight } : panelHeightStyle),
8278
}}
8379
>
84-
{splitPanel && <SplitPanelWrapper context={splitPanelContext}>{splitPanel}</SplitPanelWrapper>}
80+
{splitPanel}
8581
{!toolsHide && (
8682
<Drawer
8783
type="tools"

src/internal/context/split-panel-context.ts

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export interface SplitPanelContextProps {
2020
closedNav: boolean;
2121
closedTools: boolean;
2222
};
23-
isCopy?: boolean;
2423
isOpen?: boolean;
2524
isMobile: boolean;
2625
isForcedPosition: boolean;
@@ -47,7 +46,6 @@ export const SplitPanelContext = createContext<SplitPanelContextProps>({
4746
getMaxWidth: () => 0,
4847
getMaxHeight: () => 0,
4948
getHeader: () => null,
50-
isCopy: false,
5149
isOpen: true,
5250
isMobile: false,
5351
isForcedPosition: false,

src/split-panel/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export default function SplitPanel({
5151
bottomOffset,
5252
rightOffset,
5353
contentWidthStyles,
54-
isCopy,
5554
isOpen,
5655
isForcedPosition,
5756
splitPanelRef,
@@ -255,7 +254,7 @@ export default function SplitPanel({
255254
* is still needed for the early return to prevent execution
256255
* of the following code.
257256
*/
258-
if (isRefresh && (!isOpen || isCopy) && position === 'side') {
257+
if (isRefresh && !isOpen && position === 'side') {
259258
return <></>;
260259
}
261260

0 commit comments

Comments
 (0)