From 871e2eb25ebc7bc3ff88835397a06eccffd558d6 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 19 May 2023 17:10:17 +1000 Subject: [PATCH 1/4] Library: Rename template parts to library Also adds link to reusable blocks admin. --- .../sidebar-navigation-screen-main/index.js | 2 +- .../index.js | 44 +++++++++++++------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js index 7ad0dc07ae0f0e..2419383f72a03d 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js @@ -102,7 +102,7 @@ export default function SidebarNavigationScreenMain() { withChevron icon={ symbol } > - { __( 'Template Parts' ) } + { __( 'Library' ) } } diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js index 8c9c5638884737..6c1f1c943e82c3 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js @@ -36,12 +36,13 @@ const config = { }, wp_template_part: { labels: { - title: __( 'Template parts' ), - loading: __( 'Loading template parts' ), - notFound: __( 'No template parts found' ), - manage: __( 'Manage all template parts' ), + title: __( 'Library' ), + loading: __( 'Loading library' ), + notFound: __( 'No patterns found' ), + manage: __( 'Manage all patterns' ), + reusableBlocks: __( 'Manage reusable blocks' ), description: __( - 'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.' + 'Manage what patterns are available when editing your site.' ), }, }, @@ -123,14 +124,31 @@ export default function SidebarNavigationScreenTemplates() { ) ) } { ! isMobileViewport && ( - + <> + + { !! config[ postType ].labels + .reusableBlocks && ( + { + document.location = + 'edit.php?post_type=wp_block'; + } } + children={ + config[ postType ].labels + .reusableBlocks + } + withChevron + /> + ) } + ) } ) } From d2a22ebccdf4ea4420f4ec9caf5b86bb5518da45 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Fri, 19 May 2023 17:14:40 +0800 Subject: [PATCH 2/4] Fix e2e test --- test/e2e/specs/site-editor/site-editor-url-navigation.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js b/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js index 5668832e4162c3..5bd1fbd29d52b7 100644 --- a/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js +++ b/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js @@ -62,7 +62,7 @@ test.describe( 'Site editor url navigation', () => { page, } ) => { await admin.visitSiteEditor(); - await page.click( 'role=button[name="Template Parts"i]' ); + await page.click( 'role=button[name="Library"i]' ); await page.click( 'role=button[name="Add New"i]' ); // Fill in a name in the dialog that pops up. await page.type( From 92319c8d8c844b88d7772b09d012fa18daeae5c8 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Fri, 19 May 2023 17:15:01 +0800 Subject: [PATCH 3/4] Use link for accessibility --- .../sidebar-navigation-item/style.scss | 9 ++++++++ .../index.js | 21 ++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-item/style.scss b/packages/edit-site/src/components/sidebar-navigation-item/style.scss index fd9da59eaa888c..e9ec7ecf91909e 100644 --- a/packages/edit-site/src/components/sidebar-navigation-item/style.scss +++ b/packages/edit-site/src/components/sidebar-navigation-item/style.scss @@ -19,6 +19,15 @@ .edit-site-sidebar-navigation-item__drilldown-indicator { fill: $gray-700; } + + &:is(a) { + text-decoration: none; + + &:focus { + box-shadow: none; + outline: none; + } + } } .edit-site-sidebar-navigation-screen__content .block-editor-list-view-block-select-button { diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js index 6c1f1c943e82c3..e62d3eda15bb81 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js @@ -127,26 +127,23 @@ export default function SidebarNavigationScreenTemplates() { <> + { ...browseAllLink } + > + { config[ postType ].labels.manage } + { !! config[ postType ].labels .reusableBlocks && ( { - document.location = - 'edit.php?post_type=wp_block'; - } } - children={ + withChevron + > + { config[ postType ].labels .reusableBlocks } - withChevron - /> + ) } ) } From bb27f0da6abda4d8a67648549a8fd5fffe8cd860 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Mon, 22 May 2023 11:43:01 +1000 Subject: [PATCH 4/4] Revert renaming of Manage all template parts link --- .../src/components/sidebar-navigation-screen-templates/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js index e62d3eda15bb81..7b302be1c7e9fb 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js @@ -39,7 +39,7 @@ const config = { title: __( 'Library' ), loading: __( 'Loading library' ), notFound: __( 'No patterns found' ), - manage: __( 'Manage all patterns' ), + manage: __( 'Manage all template parts' ), reusableBlocks: __( 'Manage reusable blocks' ), description: __( 'Manage what patterns are available when editing your site.'