Skip to content

Commit

Permalink
Create and expose a new internal slot so we can re-insert the legacy …
Browse files Browse the repository at this point in the history
…controls.
  • Loading branch information
ryanwelcher committed Aug 14, 2024
1 parent ef78481 commit 331ecda
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
25 changes: 25 additions & 0 deletions src/slots/aql-legacy-controls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* WordPress dependencies
*/
import { createSlotFill } from '@wordpress/components';

/**
* Create our Slot and Fill components
*/
const { Fill, Slot } = createSlotFill( 'AQLLegacyControls' );

/**
* This slot is not exposed and is used to try to maintain the same UI
*/

const AQLLegacyControls = ( { children } ) => <Fill>{ children }</Fill>;

AQLLegacyControls.Slot = ( { fillProps } ) => (
<Slot fillProps={ fillProps }>
{ ( fills ) => {
return fills.length ? fills : null;
} }
</Slot>
);

export default AQLLegacyControls;
8 changes: 4 additions & 4 deletions src/variations/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { createBlock } from '@wordpress/blocks';
import { AQL } from '.';
import AQLControls from '../slots/aql-controls';
import AQLControlsInheritedQuery from '../slots/aql-controls-inherited-query';
import { PostCountControls } from '../components/post-count-controls';
import { PostOffsetControls } from '../components/post-offset-controls';
import AQLLegacyControls from '../slots/aql-legacy-controls';
import { PostMetaQueryControls } from '../components/post-meta-query-controls';
import { PostDateQueryControls } from '../components/post-date-query-controls';
import { MultiplePostSelect } from '../components/multiple-post-select';
Expand Down Expand Up @@ -56,9 +55,10 @@ const withAdvancedQueryControls = ( BlockEdit ) => ( props ) => {
'advanced-query-loop'
) }
>
<AQLLegacyControls.Slot
fillProps={ { ...props } }
/>
<MultiplePostSelect { ...props } />
<PostCountControls { ...props } />
<PostOffsetControls { ...props } />
<PostOrderControls { ...props } />
<PostExcludeControls { ...props } />
<PostIncludeControls { ...props } />
Expand Down

0 comments on commit 331ecda

Please sign in to comment.