Skip to content

Commit a7ff7d2

Browse files
committed
chore: tmp of it
1 parent 8426ae2 commit a7ff7d2

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

src/Popup/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export interface PopupProps {
5858
autoDestroy?: boolean;
5959
portal: React.ComponentType<any>;
6060

61+
children?: React.ReactElement;
62+
6163
// Align
6264
ready: boolean;
6365
offsetX: number;
@@ -114,6 +116,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
114116
getPopupContainer,
115117
autoDestroy,
116118
portal: Portal,
119+
children,
117120

118121
zIndex,
119122

@@ -135,7 +138,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
135138
targetHeight,
136139
} = props;
137140

138-
const childNode = typeof popup === 'function' ? popup() : popup;
141+
const popupContent = typeof popup === 'function' ? popup() : popup;
139142

140143
// We can not remove holder only when motion finished.
141144
const isNodeVisible = open || keepDom;
@@ -177,6 +180,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
177180
return null;
178181
}
179182

183+
// TODO: Move offsetStyle logic to useOffsetStyle.ts hooks
180184
// >>>>> Offset
181185
const AUTO = 'auto' as const;
182186

@@ -305,7 +309,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
305309
/>
306310
)}
307311
<PopupContent cache={!open && !fresh}>
308-
{childNode}
312+
{popupContent}
309313
</PopupContent>
310314
</div>
311315
);
@@ -314,6 +318,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
314318
);
315319
}}
316320
</ResizeObserver>
321+
{children}
317322
</Portal>
318323
);
319324
});

src/UniqueProvider/FloatBg.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
export interface FloatBgProps {
4+
prefixCls: string; // ${prefixCls}-float-bg
5+
popupEle: HTMLElement;
6+
}
7+
8+
const FloatBg = (props: FloatBgProps) => {
9+
const { prefixCls, popupEle } = props;
10+
11+
// Apply className as requested in TODO
12+
const className = `${prefixCls}-float-bg`;
13+
14+
// Remove console.log as it's for debugging only
15+
// console.log('>>>', popupEle);
16+
17+
return <div className={className} />;
18+
};
19+
20+
export default FloatBg;

src/UniqueProvider/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Popup from '../Popup';
1212
import { useEvent } from '@rc-component/util';
1313
import useTargetState from './useTargetState';
1414
import { isDOM } from '@rc-component/util/lib/Dom/findDOMNode';
15+
import FloatBg from './FloatBg';
1516

1617
export interface UniqueProviderProps {
1718
children: React.ReactNode;
@@ -32,7 +33,6 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
3233
if (isDOM(node) && popupEle !== node) {
3334
setPopupEle(node);
3435
}
35-
3636
});
3737

3838
// ========================== Register ==========================
@@ -153,7 +153,9 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
153153
motion={options.popupMotion}
154154
maskMotion={options.maskMotion}
155155
getPopupContainer={options.getPopupContainer}
156-
/>
156+
>
157+
<FloatBg prefixCls={options.prefixCls} popupEle={popupEle} />
158+
</Popup>
157159
</TriggerContext.Provider>
158160
)}
159161
</UniqueContext.Provider>

src/hooks/useOffsetStyle.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type * as React from 'react';
2+
3+
export default function useAlignStyle() {}

0 commit comments

Comments
 (0)