+
{ __( 'No patterns found.' ) }
);
diff --git a/packages/edit-site/src/components/page-library/patterns-list.js b/packages/edit-site/src/components/page-patterns/patterns-list.js
similarity index 89%
rename from packages/edit-site/src/components/page-library/patterns-list.js
rename to packages/edit-site/src/components/page-patterns/patterns-list.js
index 32ab28944ecb1..2dfe197c37963 100644
--- a/packages/edit-site/src/components/page-library/patterns-list.js
+++ b/packages/edit-site/src/components/page-patterns/patterns-list.js
@@ -51,19 +51,19 @@ export default function PatternsList( { categoryId, type } ) {
icon={ isRTL() ? chevronRight : chevronLeft }
label={ __( 'Back' ) }
onClick={ () => {
- // Go back in history if we came from the library page.
+ // Go back in history if we came from the Patterns page.
// Otherwise push a stack onto the history.
- if ( location.state?.backPath === '/library' ) {
+ if ( location.state?.backPath === '/patterns' ) {
history.back();
} else {
- history.push( { path: '/library' } );
+ history.push( { path: '/patterns' } );
}
} }
/>
) }
setFilterValue( value ) }
placeholder={ __( 'Search patterns' ) }
label={ __( 'Search patterns' ) }
@@ -75,7 +75,7 @@ export default function PatternsList( { categoryId, type } ) {
{ isResolving && __( 'Loading' ) }
{ ! isResolving && !! syncedPatterns.length && (
<>
-
+
{ __( 'Synced' ) }
{ __(
@@ -93,7 +93,7 @@ export default function PatternsList( { categoryId, type } ) {
) }
{ ! isResolving && !! unsyncedPatterns.length && (
<>
-
+
{ __( 'Standard' ) }
{ __(
diff --git a/packages/edit-site/src/components/page-library/search-items.js b/packages/edit-site/src/components/page-patterns/search-items.js
similarity index 100%
rename from packages/edit-site/src/components/page-library/search-items.js
rename to packages/edit-site/src/components/page-patterns/search-items.js
diff --git a/packages/edit-site/src/components/page-library/style.scss b/packages/edit-site/src/components/page-patterns/style.scss
similarity index 82%
rename from packages/edit-site/src/components/page-library/style.scss
rename to packages/edit-site/src/components/page-patterns/style.scss
index f0bb6b30b9db6..a7402841136e4 100644
--- a/packages/edit-site/src/components/page-library/style.scss
+++ b/packages/edit-site/src/components/page-patterns/style.scss
@@ -1,4 +1,4 @@
-.edit-site-library {
+.edit-site-patterns {
background: rgba(0, 0, 0, 0.05);
margin: $header-height 0 0;
.components-text {
@@ -14,7 +14,7 @@
}
}
-.edit-site-library__grid {
+.edit-site-patterns__grid {
column-gap: $grid-unit-30;
@include break-large() {
column-count: 2;
@@ -25,13 +25,13 @@
padding-top: $border-width-focus-fallback;
margin-bottom: $grid-unit-40;
- .edit-site-library__pattern {
+ .edit-site-patterns__pattern {
break-inside: avoid-column;
display: flex;
flex-direction: column;
margin-bottom: $grid-unit-60;
- .edit-site-library__preview {
+ .edit-site-patterns__preview {
border-radius: $radius-block-ui;
cursor: pointer;
overflow: hidden;
@@ -48,12 +48,12 @@
}
}
- .edit-site-library__footer,
- .edit-site-library__button {
+ .edit-site-patterns__footer,
+ .edit-site-patterns__button {
color: $gray-600;
}
- &.is-placeholder .edit-site-library__preview {
+ &.is-placeholder .edit-site-patterns__preview {
min-height: $grid-unit-80;
color: $gray-600;
border: 1px dashed $gray-800;
@@ -67,7 +67,7 @@
}
}
- .edit-site-library__preview {
+ .edit-site-patterns__preview {
flex: 1;
margin-bottom: $grid-unit-20;
}
@@ -75,7 +75,7 @@
// The increased specificity here is to overcome component styles
// without relying on internal component class names.
-.edit-site-library__search {
+.edit-site-patterns__search {
{&} input[type="search"] {
background: $gray-800;
color: $gray-200;
@@ -90,7 +90,7 @@
}
}
-.edit-site-library__pattern-title {
+.edit-site-patterns__pattern-title {
color: $gray-600;
svg {
@@ -100,6 +100,6 @@
}
}
-.edit-site-library__no-results {
+.edit-site-patterns__no-results {
color: $gray-600;
}
diff --git a/packages/edit-site/src/components/page-library/use-library-settings.js b/packages/edit-site/src/components/page-patterns/use-pattern-settings.js
similarity index 96%
rename from packages/edit-site/src/components/page-library/use-library-settings.js
rename to packages/edit-site/src/components/page-patterns/use-pattern-settings.js
index a0f1bfcdae393..28a16b1d7ed7d 100644
--- a/packages/edit-site/src/components/page-library/use-library-settings.js
+++ b/packages/edit-site/src/components/page-patterns/use-pattern-settings.js
@@ -12,7 +12,7 @@ import { unlock } from '../../lock-unlock';
import { store as editSiteStore } from '../../store';
import { filterOutDuplicatesByName } from './utils';
-export default function useLibrarySettings() {
+export default function usePatternSettings() {
const storedSettings = useSelect( ( select ) => {
const { getSettings } = unlock( select( editSiteStore ) );
return getSettings();
diff --git a/packages/edit-site/src/components/page-library/use-patterns.js b/packages/edit-site/src/components/page-patterns/use-patterns.js
similarity index 100%
rename from packages/edit-site/src/components/page-library/use-patterns.js
rename to packages/edit-site/src/components/page-patterns/use-patterns.js
diff --git a/packages/edit-site/src/components/page-library/utils.js b/packages/edit-site/src/components/page-patterns/utils.js
similarity index 100%
rename from packages/edit-site/src/components/page-library/utils.js
rename to packages/edit-site/src/components/page-patterns/utils.js
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss
deleted file mode 100644
index efb8b7537588d..0000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.edit-site-sidebar-navigation-screen-library__group {
- margin-bottom: $grid-unit-30;
-}
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 6e7810abe81c0..58b93d61c45a6 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
@@ -75,11 +75,11 @@ export default function SidebarNavigationScreenMain() {
- { __( 'Library' ) }
+ { __( 'Patterns' ) }
}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
index 349cc5d43b431..39f28dba6d520 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
@@ -33,7 +33,7 @@ export default function SidebarNavigationScreenPattern() {
const backPath =
! categoryType && postType === 'wp_template_part'
? '/wp_template_part/all'
- : '/library';
+ : '/patterns';
return (
- { isLoading && __( 'Loading library' ) }
+ { isLoading && __( 'Loading patterns' ) }
{ ! isLoading && (
<>
{ ! hasTemplateParts && ! hasPatterns && (
-
+
-
{ __(
'No template parts or patterns found'
@@ -89,7 +89,7 @@ export default function SidebarNavigationScreenLibrary() {
) }
{ hasMyPatterns && (
-
+
) }
{ hasTemplateParts && (
-
+
{ Object.entries( templatePartAreas ).map(
( [ area, parts ] ) => (
) }
{ hasPatterns && (
-
+
{ patternCategories.map( ( category ) => (
{
- const groupedByArea = items.reduce(
- ( accumulator, item ) => {
- const key = accumulator[ item.area ] ? item.area : 'rest';
- accumulator[ key ].push( item );
- return accumulator;
- },
- { header: [], footer: [], sidebar: [], rest: [] }
- );
- return [
- ...groupedByArea.header,
- ...groupedByArea.footer,
- ...groupedByArea.sidebar,
- ...groupedByArea.rest,
- ];
- },
- },
-};
-
const TemplateItem = ( { postType, postId, ...props } ) => {
const linkInfo = useLink( {
postType,
@@ -74,9 +30,6 @@ const TemplateItem = ( { postType, postId, ...props } ) => {
};
export default function SidebarNavigationScreenTemplates() {
- const {
- params: { postType },
- } = useNavigator();
const isMobileViewport = useViewportMatch( 'medium', '<' );
const isTemplatePartsMode = useSelect( ( select ) => {
const settings = select( editSiteStore ).getSettings();
@@ -86,34 +39,30 @@ export default function SidebarNavigationScreenTemplates() {
const { records: templates, isResolving: isLoading } = useEntityRecords(
'postType',
- postType,
+ 'wp_template',
{
per_page: -1,
}
);
- let sortedTemplates = templates ? [ ...templates ] : [];
+
+ const sortedTemplates = templates ? [ ...templates ] : [];
sortedTemplates.sort( ( a, b ) =>
a.title.rendered.localeCompare( b.title.rendered )
);
- if ( config[ postType ].sortCallback ) {
- sortedTemplates = config[ postType ].sortCallback( sortedTemplates );
- }
-
- const browseAllLink = useLink( {
- path: '/' + postType + '/all',
- } );
+ const browseAllLink = useLink( { path: '/wp_template/all' } );
const canCreate = ! isMobileViewport && ! isTemplatePartsMode;
- const isTemplateList = postType === 'wp_template';
return (
- { isLoading && config[ postType ].labels.loading }
+ { isLoading && __( 'Loading templates' ) }
{ ! isLoading && (
{ ! templates?.length && (
- -
- { config[ postType ].labels.notFound }
-
+ - { __( 'No templates found' ) }
) }
{ sortedTemplates.map( ( template ) => (
{ decodeEntities(
template.title?.rendered ||
@@ -153,19 +96,9 @@ export default function SidebarNavigationScreenTemplates() {
}
footer={
! isMobileViewport && (
- <>
-
- { config[ postType ].labels.manage }
-
- { !! config[ postType ].labels.reusableBlocks && (
-
- { config[ postType ].labels.reusableBlocks }
-
- ) }
- >
+
+ { __( 'Manage all templates' ) }
+
)
}
/>
diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js
index df6a566503140..9e035759ea9ad 100644
--- a/packages/edit-site/src/components/sidebar/index.js
+++ b/packages/edit-site/src/components/sidebar/index.js
@@ -12,9 +12,9 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
* Internal dependencies
*/
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
-import SidebarNavigationScreenLibrary from '../sidebar-navigation-screen-library';
import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
+import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
import SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';
import useSyncPathWithURL, {
getPathFromURL,
@@ -56,8 +56,8 @@ function SidebarScreens() {
-
-
+
+
diff --git a/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js
index ee9fa0fffb801..45f7eb1b044c1 100644
--- a/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js
+++ b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js
@@ -87,7 +87,7 @@ export default function useSyncPathWithURL() {
postId: navigatorParams?.postId,
path: undefined,
} );
- } else if ( navigatorLocation.path === '/library' ) {
+ } else if ( navigatorLocation.path === '/patterns' ) {
updateUrlParams( {
postType: undefined,
postId: undefined,
diff --git a/packages/edit-site/src/style.scss b/packages/edit-site/src/style.scss
index 324f1ab4bc0ec..5a7f96433518a 100644
--- a/packages/edit-site/src/style.scss
+++ b/packages/edit-site/src/style.scss
@@ -10,7 +10,7 @@
@import "./components/header-edit-mode/document-actions/style.scss";
@import "./components/list/style.scss";
@import "./components/page/style.scss";
-@import "./components/page-library/style.scss";
+@import "./components/page-patterns/style.scss";
@import "./components/table/style.scss";
@import "./components/sidebar-edit-mode/style.scss";
@import "./components/sidebar-edit-mode/page-panels/style.scss";
@@ -33,11 +33,11 @@
@import "./components/sidebar-navigation-screen/style.scss";
@import "./components/sidebar-navigation-screen-details-footer/style.scss";
@import "./components/sidebar-navigation-screen-global-styles/style.scss";
-@import "./components/sidebar-navigation-screen-library/style.scss";
@import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
@import "./components/sidebar-navigation-screen-page/style.scss";
@import "components/sidebar-navigation-screen-details-panel/style.scss";
@import "./components/sidebar-navigation-screen-pattern/style.scss";
+@import "./components/sidebar-navigation-screen-patterns/style.scss";
@import "./components/sidebar-navigation-screen-template/style.scss";
@import "./components/site-hub/style.scss";
@import "./components/sidebar-navigation-screen-navigation-menus/style.scss";
diff --git a/packages/edit-site/src/utils/get-is-list-page.js b/packages/edit-site/src/utils/get-is-list-page.js
index 11827432071bd..600e686618bf9 100644
--- a/packages/edit-site/src/utils/get-is-list-page.js
+++ b/packages/edit-site/src/utils/get-is-list-page.js
@@ -16,9 +16,9 @@ export default function getIsListPage(
return (
path === '/wp_template/all' ||
path === '/wp_template_part/all' ||
- ( path === '/library' &&
- // Don't treat "/library" without categoryType and categoryId as a list page
- // in mobile because the sidebar covers the whole page.
+ ( path === '/patterns' &&
+ // Don't treat "/patterns" without categoryType and categoryId as a
+ // list page in mobile because the sidebar covers the whole page.
( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )
);
}
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 90daa3ae50c24..c16411d45ce79 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="Library"i]' );
+ await page.click( 'role=button[name="Patterns"i]' );
await page.click( 'role=button[name="Create pattern"i]' );
await page
.getByRole( 'menu', { name: 'Create pattern' } )