From 433a73c53b2cac020a5e31e4fdea51ecedfdfe39 Mon Sep 17 00:00:00 2001 From: lyn <76365499@qq.com> Date: Fri, 24 Feb 2023 09:04:03 +0800 Subject: [PATCH] fix: typos (#40899) --- components/affix/index.tsx | 36 ++++++++++++++++++------------------ components/affix/utils.ts | 8 ++++---- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 04c7db2698..f7e5939e0c 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -165,15 +165,15 @@ class InternalAffix extends React.Component { status: AffixStatus.None, }; const targetRect = getTargetRect(targetNode); - const placeholderReact = getTargetRect(this.placeholderNodeRef.current); - const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop); - const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom); + const placeholderRect = getTargetRect(this.placeholderNodeRef.current); + const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop); + const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom); if ( - placeholderReact.top === 0 && - placeholderReact.left === 0 && - placeholderReact.width === 0 && - placeholderReact.height === 0 + placeholderRect.top === 0 && + placeholderRect.left === 0 && + placeholderRect.width === 0 && + placeholderRect.height === 0 ) { return; } @@ -182,23 +182,23 @@ class InternalAffix extends React.Component { newState.affixStyle = { position: 'fixed', top: fixedTop, - width: placeholderReact.width, - height: placeholderReact.height, + width: placeholderRect.width, + height: placeholderRect.height, }; newState.placeholderStyle = { - width: placeholderReact.width, - height: placeholderReact.height, + width: placeholderRect.width, + height: placeholderRect.height, }; } else if (fixedBottom !== undefined) { newState.affixStyle = { position: 'fixed', bottom: fixedBottom, - width: placeholderReact.width, - height: placeholderReact.height, + width: placeholderRect.width, + height: placeholderRect.height, }; newState.placeholderStyle = { - width: placeholderReact.width, - height: placeholderReact.height, + width: placeholderRect.width, + height: placeholderRect.height, }; } @@ -241,9 +241,9 @@ class InternalAffix extends React.Component { const targetNode = targetFunc(); if (targetNode && this.placeholderNodeRef.current) { const targetRect = getTargetRect(targetNode); - const placeholderReact = getTargetRect(this.placeholderNodeRef.current); - const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop); - const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom); + const placeholderRect = getTargetRect(this.placeholderNodeRef.current); + const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop); + const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom); if ( (fixedTop !== undefined && affixStyle.top === fixedTop) || diff --git a/components/affix/utils.ts b/components/affix/utils.ts index db127fec09..74b406038b 100644 --- a/components/affix/utils.ts +++ b/components/affix/utils.ts @@ -9,19 +9,19 @@ export function getTargetRect(target: BindElement): DOMRect { : ({ top: 0, bottom: window.innerHeight } as DOMRect); } -export function getFixedTop(placeholderReact: DOMRect, targetRect: DOMRect, offsetTop?: number) { - if (offsetTop !== undefined && targetRect.top > placeholderReact.top - offsetTop) { +export function getFixedTop(placeholderRect: DOMRect, targetRect: DOMRect, offsetTop?: number) { + if (offsetTop !== undefined && targetRect.top > placeholderRect.top - offsetTop) { return offsetTop + targetRect.top; } return undefined; } export function getFixedBottom( - placeholderReact: DOMRect, + placeholderRect: DOMRect, targetRect: DOMRect, offsetBottom?: number, ) { - if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) { + if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) { const targetBottomOffset = window.innerHeight - targetRect.bottom; return offsetBottom + targetBottomOffset; }