Skip to content

Commit 331ecda

Browse files
committed
Create and expose a new internal slot so we can re-insert the legacy controls.
1 parent ef78481 commit 331ecda

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/slots/aql-legacy-controls.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import { createSlotFill } from '@wordpress/components';
5+
6+
/**
7+
* Create our Slot and Fill components
8+
*/
9+
const { Fill, Slot } = createSlotFill( 'AQLLegacyControls' );
10+
11+
/**
12+
* This slot is not exposed and is used to try to maintain the same UI
13+
*/
14+
15+
const AQLLegacyControls = ( { children } ) => <Fill>{ children }</Fill>;
16+
17+
AQLLegacyControls.Slot = ( { fillProps } ) => (
18+
<Slot fillProps={ fillProps }>
19+
{ ( fills ) => {
20+
return fills.length ? fills : null;
21+
} }
22+
</Slot>
23+
);
24+
25+
export default AQLLegacyControls;

src/variations/controls.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import { createBlock } from '@wordpress/blocks';
1212
import { AQL } from '.';
1313
import AQLControls from '../slots/aql-controls';
1414
import AQLControlsInheritedQuery from '../slots/aql-controls-inherited-query';
15-
import { PostCountControls } from '../components/post-count-controls';
16-
import { PostOffsetControls } from '../components/post-offset-controls';
15+
import AQLLegacyControls from '../slots/aql-legacy-controls';
1716
import { PostMetaQueryControls } from '../components/post-meta-query-controls';
1817
import { PostDateQueryControls } from '../components/post-date-query-controls';
1918
import { MultiplePostSelect } from '../components/multiple-post-select';
@@ -56,9 +55,10 @@ const withAdvancedQueryControls = ( BlockEdit ) => ( props ) => {
5655
'advanced-query-loop'
5756
) }
5857
>
58+
<AQLLegacyControls.Slot
59+
fillProps={ { ...props } }
60+
/>
5961
<MultiplePostSelect { ...props } />
60-
<PostCountControls { ...props } />
61-
<PostOffsetControls { ...props } />
6262
<PostOrderControls { ...props } />
6363
<PostExcludeControls { ...props } />
6464
<PostIncludeControls { ...props } />

0 commit comments

Comments
 (0)