From 8d7697959dbb21f6a239aa2c6b2c84d39df8493e Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Wed, 19 Jul 2023 13:41:14 +0900 Subject: [PATCH] Don't use resize observer --- package-lock.json | 1 - package.json | 1 - src/components/keyboard/index.tsx | 21 ++------------------- src/components/keyboard/style.scss | 7 +++---- src/components/piano/style.scss | 1 - src/constants.ts | 2 -- 6 files changed, 5 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index b448360..0b42888 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@types/wordpress__components": "^23.0.1", "@types/wordpress__dom-ready": "2.9.0", "@types/wordpress__i18n": "^3.11.0", - "@wordpress/compose": "6.14.0", "@wordpress/e2e-test-utils": "10.8.0", "@wordpress/env": "^8.3.0", "@wordpress/icons": "^9.28.0", diff --git a/package.json b/package.json index 9ab02cd..04c1a08 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "@types/wordpress__components": "^23.0.1", "@types/wordpress__dom-ready": "2.9.0", "@types/wordpress__i18n": "^3.11.0", - "@wordpress/compose": "6.14.0", "@wordpress/e2e-test-utils": "10.8.0", "@wordpress/env": "^8.3.0", "@wordpress/icons": "^9.28.0", diff --git a/src/components/keyboard/index.tsx b/src/components/keyboard/index.tsx index fefcd5d..5c7237b 100644 --- a/src/components/keyboard/index.tsx +++ b/src/components/keyboard/index.tsx @@ -7,15 +7,10 @@ import classnames from 'classnames'; * WordPress dependencies */ import { __, sprintf } from '@wordpress/i18n'; -import { - // @ts-ignore: has no exported member - useResizeObserver, -} from '@wordpress/compose'; /** * Internal dependencies */ -import { KEYBOARD_WIDTH, KEYBOARD_PADDING } from '../../constants'; import { KEYBOARD_LAYOUTS } from '../../keyboard-layout'; import type { Key } from '../../constants'; @@ -26,9 +21,6 @@ type Props = { }; const Keyboard = ( { activeKeys, keyLayout, onKeyClick }: Props ) => { - // Hooks to control the display of horizontal scroll bars. - const [ resizeListener, keysInnerSizes ] = useResizeObserver(); - const keys = KEYBOARD_LAYOUTS.find( ( { value } ) => value === keyLayout )?.keys || KEYBOARD_LAYOUTS[ 0 ].keys; @@ -39,17 +31,8 @@ const Keyboard = ( { activeKeys, keyLayout, onKeyClick }: Props ) => { }; return ( -
- { resizeListener } -
+
+
{ keys.map( ( key, index ) => (