Skip to content

Commit

Permalink
[Global Styles]: Add block icon next to blocks list (#36520)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored and noisysocks committed Nov 22, 2021
1 parent 460d63b commit b224bf8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
*/
import { getBlockTypes } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import {
FlexItem,
__experimentalHStack as HStack,
} from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand All @@ -29,7 +34,12 @@ function BlockMenuItem( { block } ) {

return (
<NavigationButton path={ '/blocks/' + block.name }>
{ block.title }
<HStack justify="flex-start">
<FlexItem>
<BlockIcon icon={ block.icon } />
</FlexItem>
<FlexItem>{ block.title }</FlexItem>
</HStack>
</NavigationButton>
);
}
Expand Down

0 comments on commit b224bf8

Please sign in to comment.