Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Global Styles: tell apart the two empty states in the block list
When the list came back empty it always said "No blocks found.", which
reads as a search result even when the search box is empty and the
Customized filter is what emptied the list.

Split the message so a filtered-but-empty list says the user has not
customized anything yet, and move the search row's spacing onto the
grid-unit scale.
  • Loading branch information
ramonjd committed Aug 18, 2026
commit 186331ba2c39a8c6e2db8f3ad94261b3275c8321
22 changes: 18 additions & 4 deletions packages/global-styles-ui/src/screen-block-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,22 @@ function BlockMenuItem( { block, isCustomized }: BlockMenuItemProps ) {
);
}

function EmptyBlockList( { styleFilter }: { styleFilter: StyleFilter } ) {
const label =
'customized' === styleFilter
? __( "You haven't customized any blocks yet." )
: __( 'No blocks found.' );
Comment thread
ramonjd marked this conversation as resolved.
Outdated
return (
<WCText
align="center"
as="p"
className="global-styles-ui-block-types-item-list__no-results"
>
{ label }
</WCText>
);
}

interface BlockListProps {
filterValue: string;
styleFilter: StyleFilter;
Expand All @@ -182,7 +198,6 @@ function BlockList( { filterValue, styleFilter }: BlockListProps ) {
const sortedBlockTypes = useSortedBlockTypes();
const debouncedSpeak = useDebounce( speak, 500 );
const { isMatchingSearchTerm } = useSelect( blocksStore );

const { user } = useContext( GlobalStylesContext );

// Computed once for the whole list rather than per row, so the list does
Expand Down Expand Up @@ -246,9 +261,7 @@ function BlockList( { filterValue, styleFilter }: BlockListProps ) {
role="list"
>
{ filteredBlockTypes.length === 0 ? (
<WCText align="center" as="p">
{ __( 'No blocks found.' ) }
</WCText>
<EmptyBlockList styleFilter={ styleFilter } />
) : (
filteredBlockTypes.map( ( block ) => (
<BlockMenuItem
Expand Down Expand Up @@ -288,6 +301,7 @@ function ScreenBlockList() {
value={ filterValue }
label={ __( 'Search' ) }
placeholder={ __( 'Search' ) }
size="compact"
/>
<Menu>
<Menu.TriggerButton
Expand Down
8 changes: 6 additions & 2 deletions packages/global-styles-ui/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
}

.global-styles-ui-block-types-filter {
margin-bottom: 10px;
padding: 0 16px;
margin-bottom: variables.$grid-unit-15;
padding: 0 variables.$grid-unit-20;
}

.global-styles-ui-block-types-search {
Expand All @@ -67,6 +67,10 @@
width: 6px;
}

.global-styles-ui-block-types-item-list__no-results {
padding-top: variables.$grid-unit-20;
}

.global-styles-ui-screen-typography__font-variants-count {
color: colors.$gray-700;
}
Expand Down