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

Template Parts: Remove pattern title from sidebar #60160

Merged
merged 1 commit into from Mar 25, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 22 additions & 17 deletions packages/block-editor/src/components/block-patterns-list/index.js
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
Expand Up @@ -91,6 +91,7 @@ function TemplatesList( { availableTemplates, onSelect } ) {
blockPatterns={ availableTemplates }
shownPatterns={ shownTemplates }
onClickPattern={ onSelect }
showTitle={ false }
/>
);
}
Expand Down