Skip to content

Commit c074481

Browse files
committed
Fix animated transition
1 parent e00013d commit c074481

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/internal/generated/styles/tokens.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ export const spaceScaledS: string;
7272

7373
// Line height
7474
export const lineHeightBodyM: string;
75+
76+
// Border thickness
77+
export const borderPanelTopWidth: string;

src/split-panel/bottom.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal
77

88
import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
99
import { useSplitPanelContext } from '../internal/context/split-panel-context';
10+
import * as tokens from '../internal/generated/styles/tokens';
1011
import { useMobile } from '../internal/hooks/use-mobile';
1112
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
1213
import { SplitPanelContentProps } from './interfaces';
@@ -45,7 +46,14 @@ export function SplitPanelContentBottom({
4546
const isMobile = useMobile();
4647

4748
const headerRef = useRef<HTMLDivElement>(null);
48-
useResizeObserver(headerRef, entry => reportHeaderHeight(entry.borderBoxHeight));
49+
const closedPanelBlockSize = useRef<string>();
50+
51+
useResizeObserver(headerRef, entry => {
52+
const { borderBoxHeight } = entry;
53+
closedPanelBlockSize.current = `calc(${borderBoxHeight}px + ${tokens.borderPanelTopWidth})`;
54+
reportHeaderHeight(borderBoxHeight);
55+
});
56+
4957
useEffect(() => {
5058
// report empty height when unmounting the panel
5159
return () => reportHeaderHeight(0);
@@ -75,7 +83,7 @@ export function SplitPanelContentBottom({
7583
insetBlockEnd: bottomOffset,
7684
insetInlineStart: leftOffset,
7785
insetInlineEnd: rightOffset,
78-
blockSize: isOpen ? cappedSize : undefined,
86+
blockSize: isOpen ? cappedSize : isToolbar ? closedPanelBlockSize.current : undefined,
7987
}}
8088
ref={splitPanelRef}
8189
>

0 commit comments

Comments
 (0)