Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query block: style the change design drop down to match the zoomed out section toolbar #67553

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 32 additions & 26 deletions packages/block-library/src/query/edit/query-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,44 @@ import { __ } from '@wordpress/i18n';
*/
import PatternSelection, { useBlockPatterns } from './pattern-selection';

const POPOVER_PROPS = {
placement: 'bottom-start',
};

export default function QueryToolbar( { clientId, attributes } ) {
const hasPatterns = useBlockPatterns( clientId, attributes ).length;
if ( ! hasPatterns ) {
return null;
}

return (
<ToolbarGroup className="wp-block-template-part__block-control-group">
<DropdownContentWrapper>
<Dropdown
contentClassName="block-editor-block-settings-menu__popover"
focusOnMount="firstElement"
expandOnMobile
renderToggle={ ( { isOpen, onToggle } ) => (
<ToolbarButton
aria-haspopup="true"
aria-expanded={ isOpen }
onClick={ onToggle }
>
{ __( 'Change design' ) }
</ToolbarButton>
) }
renderContent={ () => (
<PatternSelection
clientId={ clientId }
attributes={ attributes }
showSearch={ false }
showTitlesAsTooltip
/>
) }
/>
</DropdownContentWrapper>
</ToolbarGroup>
<Dropdown
popoverProps={ POPOVER_PROPS }
expandOnMobile
renderToggle={ ( { isOpen, onToggle } ) => (
<ToolbarGroup>
<ToolbarButton
aria-haspopup="true"
aria-expanded={ isOpen }
onClick={ onToggle }
>
{ __( 'Change design' ) }
</ToolbarButton>
</ToolbarGroup>
) }
renderContent={ () => (
<DropdownContentWrapper
className="block-library-query__toolbar-popover-content-wrapper"
paddingSize="none"
>
<PatternSelection
clientId={ clientId }
attributes={ attributes }
showSearch={ false }
showTitlesAsTooltip
/>
</DropdownContentWrapper>
) }
/>
);
}
22 changes: 10 additions & 12 deletions packages/block-library/src/query/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@
margin: 0;
}

.block-editor-block-settings-menu__popover {
&.is-expanded {
overflow-y: scroll;
}
.block-library-query-pattern__selection-content {
height: 100%;
.block-library-query__toolbar-popover-content-wrapper {
padding: $grid-unit-15;
width: auto;
@include break-small() {
width: 320px;
}
.block-editor-block-patterns-list {
display: grid;
Expand All @@ -75,12 +74,11 @@
grid-template-columns: 1fr 1fr;
}
grid-gap: $grid-unit-15;
min-width: $break-zoomed-in;
@include break-small() {
min-width: $break-mobile;
.block-editor-block-patterns-list__list-item {
margin-bottom: 0;
}
.block-editor-inserter__media-list__list-item {
min-height: 100px;
}
}
.block-editor-block-patterns-list__list-item {
margin-bottom: 0;
}
}
Loading