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

[Inserter]: Replace text in Reusable tab with an icon #45851

Merged
merged 5 commits into from
Nov 18, 2022
Merged
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
6 changes: 6 additions & 0 deletions packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ $block-inserter-tabs-height: 44px;
.components-tab-panel__tabs-item {
flex-grow: 1;
margin-bottom: -$border-width;
&[id$="reusable"] {
flex-grow: inherit;
// These are to align the `reusable` icon with the search icon.
padding-left: $grid-unit-20;
padding-right: $grid-unit-20;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/inserter/tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* WordPress dependencies
*/
import { symbol as reusableBlockIcon } from '@wordpress/icons';
import { useMemo } from '@wordpress/element';
import { TabPanel } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
Expand All @@ -19,6 +20,7 @@ const reusableBlocksTab = {
name: 'reusable',
/* translators: Reusable blocks tab title in the block inserter. */
title: __( 'Reusable' ),
icon: reusableBlockIcon,
};

function InserterTabs( {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/search-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
width: 100%;
height: $grid-unit-60;

// Unset inherited values.
margin-left: 0;
margin-right: 0;

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: $mobile-text-min-font-size;
@include break-small {
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-test-utils/src/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ export async function searchForReusableBlock( searchTerm ) {
// fetched. They aren't fetched until an inserter is used or the post
// already contains reusable blocks, so wait for the tab to appear.
await page.waitForXPath(
'//div[contains(@class, "block-editor-inserter__tabs")]//button[text()="Reusable"]'
'//div[contains(@class, "block-editor-inserter__tabs")]//button[@aria-label="Reusable"]'
);

// Select the reusable blocks tab.
const tab = await page.waitForXPath(
'//div[contains(@class, "block-editor-inserter__tabs")]//button[text()="Reusable"]'
'//div[contains(@class, "block-editor-inserter__tabs")]//button[@aria-label="Reusable"]'
);
await tab.click();
await page.waitForSelector( INSERTER_SEARCH_SELECTOR );
Expand Down