Skip to content

Commit

Permalink
Template Parts: Remove pattern title from sidebar (WordPress#60160)
Browse files Browse the repository at this point in the history
Co-authored-by: scruffian <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: richtabor <[email protected]>
  • Loading branch information
4 people authored and cbravobernal committed Apr 9, 2024
1 parent 156cf67 commit 1bfad55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
39 changes: 22 additions & 17 deletions packages/block-editor/src/components/block-patterns-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function BlockPattern( {
pattern,
onClick,
onHover,
showTitle = true,
showTooltip,
} ) {
const [ isDragging, setIsDragging ] = useState( false );
Expand Down Expand Up @@ -122,25 +123,27 @@ function BlockPattern( {
viewportWidth={ viewportWidth }
/>

<HStack className="block-editor-patterns__pattern-details">
{ pattern.type ===
INSERTER_PATTERN_TYPES.user &&
! pattern.syncStatus && (
<div className="block-editor-patterns__pattern-icon-wrapper">
<Icon
className="block-editor-patterns__pattern-icon"
icon={ symbol }
/>
{ showTitle && (
<HStack className="block-editor-patterns__pattern-details">
{ pattern.type ===
INSERTER_PATTERN_TYPES.user &&
! pattern.syncStatus && (
<div className="block-editor-patterns__pattern-icon-wrapper">
<Icon
className="block-editor-patterns__pattern-icon"
icon={ symbol }
/>
</div>
) }
{ ( ! showTooltip ||
pattern.type ===
INSERTER_PATTERN_TYPES.user ) && (
<div className="block-editor-block-patterns-list__item-title">
{ pattern.title }
</div>
) }
{ ( ! showTooltip ||
pattern.type ===
INSERTER_PATTERN_TYPES.user ) && (
<div className="block-editor-block-patterns-list__item-title">
{ pattern.title }
</div>
) }
</HStack>
</HStack>
) }

{ !! pattern.description && (
<VisuallyHidden id={ descriptionId }>
Expand Down Expand Up @@ -170,6 +173,7 @@ function BlockPatternsList(
onClickPattern,
orientation,
label = __( 'Block patterns' ),
showTitle = true,
showTitlesAsTooltip,
pagingProps,
},
Expand Down Expand Up @@ -203,6 +207,7 @@ function BlockPatternsList(
onClick={ onClickPattern }
onHover={ onHover }
isDraggable={ isDraggable }
showTitle={ showTitle }
showTooltip={ showTitlesAsTooltip }
/>
) : (
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/template-part/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function TemplatesList( { availableTemplates, onSelect } ) {
blockPatterns={ availableTemplates }
shownPatterns={ shownTemplates }
onClickPattern={ onSelect }
showTitle={ false }
/>
);
}
Expand Down

0 comments on commit 1bfad55

Please sign in to comment.