From 823665533d4716803307fcb457571ba1290422ac Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Wed, 21 Jul 2021 09:28:44 -0700 Subject: [PATCH] Renames and cleanup --- .../src/blocks/legacy-widget/edit/form.js | 21 ++++--- .../src/blocks/legacy-widget/edit/utils.js | 61 +++++++++---------- .../src/blocks/legacy-widget/editor.scss | 2 +- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/packages/widgets/src/blocks/legacy-widget/edit/form.js b/packages/widgets/src/blocks/legacy-widget/edit/form.js index 4bca14ab26ddb..7677df1d054b2 100644 --- a/packages/widgets/src/blocks/legacy-widget/edit/form.js +++ b/packages/widgets/src/blocks/legacy-widget/edit/form.js @@ -19,7 +19,7 @@ import { closeSmall } from '@wordpress/icons'; * Internal dependencies */ import Control from './control'; -import { useBudgeTopBy } from './utils'; +import { useAlignTopWithinViewport } from './utils'; export default function Form( { title, @@ -109,7 +109,7 @@ export default function Form( { if ( isWide ) { return ( - + { formCore } ); @@ -125,16 +125,19 @@ export default function Form( { ); } -function WideFormDialog( { isVisible, children } ) { - const containerRef = useRef(); - const [ dialogRef, dialogProps ] = useDialog( { focusOnMount: false } ); +function WideFormDialog( { isVisible, onClose, children } ) { + const ref = useRef(); + const [ dialogRef, dialogProps ] = useDialog( { + focusOnMount: false, + onClose, + } ); const { - ref: budgeRef, + ref: alignTopRef, resizeObserver, - } = useBudgeTopBy( containerRef.current, { isEnabled: isVisible } ); + } = useAlignTopWithinViewport( ref.current, { isEnabled: isVisible } ); return (