Skip to content

Commit

Permalink
Prevent color palette panel recreating popoverProps
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed May 2, 2023
1 parent 7430b2d commit cb84322
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -15,6 +15,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { unlock } from '../../private-apis';

const { useGlobalSetting } = unlock( blockEditorPrivateApis );
const mobilePopoverProps = { placement: 'bottom-start', offset: 8 };

export default function ColorPalettePanel( { name } ) {
const [ themeColors, setThemeColors ] = useGlobalSetting(
Expand Down Expand Up @@ -46,12 +47,7 @@ export default function ColorPalettePanel( { name } ) {
);

const isMobileViewport = useViewportMatch( 'small', '<' );
const popoverProps = isMobileViewport
? {
placement: 'bottom-start',
offset: 8,
}
: undefined;
const popoverProps = isMobileViewport ? mobilePopoverProps : undefined;

return (
<VStack
Expand Down

0 comments on commit cb84322

Please sign in to comment.