From b3af8d7a36f8d9c79f155262bc8bc58378fb7188 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 20 Dec 2022 20:56:23 +0200 Subject: [PATCH 1/2] [Block Library - Query Loop]: Show pattern titles in setup --- .../components/block-pattern-setup/index.js | 21 +++++++++++----- .../components/block-pattern-setup/style.scss | 24 +++++++++++++++++++ .../block-library/src/query/edit/index.js | 1 + 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-pattern-setup/index.js b/packages/block-editor/src/components/block-pattern-setup/index.js index d36bc4ae80aa1..b39aa070c529e 100644 --- a/packages/block-editor/src/components/block-pattern-setup/index.js +++ b/packages/block-editor/src/components/block-pattern-setup/index.js @@ -28,6 +28,7 @@ const SetupContent = ( { activeSlide, patterns, onBlockPatternSelect, + showTitles, } ) => { const composite = useCompositeState(); const containerClass = 'block-editor-block-pattern-setup__container'; @@ -67,6 +68,7 @@ const SetupContent = ( { pattern={ pattern } onSelect={ onBlockPatternSelect } composite={ composite } + showTitles={ showTitles } /> ) ) } @@ -74,7 +76,7 @@ const SetupContent = ( { ); }; -function BlockPattern( { pattern, onSelect, composite } ) { +function BlockPattern( { pattern, onSelect, composite, showTitles } ) { const baseClassName = 'block-editor-block-pattern-setup-list'; const { blocks, description, viewportWidth = 700 } = pattern; const descriptionId = useInstanceId( @@ -98,12 +100,17 @@ function BlockPattern( { pattern, onSelect, composite } ) { blocks={ blocks } viewportWidth={ viewportWidth } /> + { showTitles && ( +
+ { pattern.title } +
+ ) } + { !! description && ( + + { description } + + ) } - { !! description && ( - - { description } - - ) } ); } @@ -139,6 +146,7 @@ const BlockPatternSetup = ( { filterPatternsFn, onBlockPatternSelect, initialViewMode = VIEWMODES.carousel, + showTitles = false, } ) => { const [ viewMode, setViewMode ] = useState( initialViewMode ); const [ activeSlide, setActiveSlide ] = useState( 0 ); @@ -165,6 +173,7 @@ const BlockPatternSetup = ( { activeSlide={ activeSlide } patterns={ patterns } onBlockPatternSelect={ onPatternSelectCallback } + showTitles={ showTitles } /> From 95e3d41ea806a9f147a982ffe235ddd13fbf03bb Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Wed, 21 Dec 2022 09:39:35 +0200 Subject: [PATCH 2/2] change cursors of pattern title --- .../block-editor/src/components/block-pattern-setup/style.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-editor/src/components/block-pattern-setup/style.scss b/packages/block-editor/src/components/block-pattern-setup/style.scss index aabce8b62ca88..c1b85f511d951 100644 --- a/packages/block-editor/src/components/block-pattern-setup/style.scss +++ b/packages/block-editor/src/components/block-pattern-setup/style.scss @@ -55,6 +55,7 @@ padding-top: $grid-unit-10; font-size: 12px; text-align: center; + cursor: pointer; } .block-editor-block-preview__container {