From b40ea4a06950c94a46f410d734cb6fd3b9938c4d Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:17:33 +1000 Subject: [PATCH] Patterns: Rename Library to Patterns (#52102) --- .../src/site-editor-navigation-commands.js | 2 +- .../components/create-pattern-modal/index.js | 2 +- .../src/components/page-main/index.js | 6 +- .../grid-item.js | 14 +-- .../{page-library => page-patterns}/grid.js | 2 +- .../{page-library => page-patterns}/index.js | 10 +- .../no-patterns.js | 2 +- .../patterns-list.js | 12 +-- .../search-items.js | 0 .../style.scss | 22 ++--- .../use-pattern-settings.js} | 2 +- .../use-patterns.js | 0 .../{page-library => page-patterns}/utils.js | 0 .../style.scss | 3 - .../sidebar-navigation-screen-main/index.js | 4 +- .../index.js | 2 +- .../category-item.js | 6 +- .../index.js | 16 +-- .../style.scss | 3 + .../use-default-pattern-categories.js | 0 .../use-my-patterns.js | 0 .../use-pattern-categories.js | 0 .../use-template-part-areas.js | 0 .../use-theme-patterns.js | 2 +- .../index.js | 2 +- .../index.js | 97 +++---------------- .../edit-site/src/components/sidebar/index.js | 6 +- .../use-sync-path-with-url.js | 2 +- packages/edit-site/src/style.scss | 4 +- .../edit-site/src/utils/get-is-list-page.js | 6 +- .../site-editor-url-navigation.spec.js | 2 +- 31 files changed, 81 insertions(+), 148 deletions(-) rename packages/edit-site/src/components/{page-library => page-patterns}/grid-item.js (92%) rename packages/edit-site/src/components/{page-library => page-patterns}/grid.js (94%) rename packages/edit-site/src/components/{page-library => page-patterns}/index.js (83%) rename packages/edit-site/src/components/{page-library => page-patterns}/no-patterns.js (77%) rename packages/edit-site/src/components/{page-library => page-patterns}/patterns-list.js (89%) rename packages/edit-site/src/components/{page-library => page-patterns}/search-items.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/style.scss (82%) rename packages/edit-site/src/components/{page-library/use-library-settings.js => page-patterns/use-pattern-settings.js} (96%) rename packages/edit-site/src/components/{page-library => page-patterns}/use-patterns.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/utils.js (100%) delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/category-item.js (86%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/index.js (94%) create mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-patterns/style.scss rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-default-pattern-categories.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-my-patterns.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-pattern-categories.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-template-part-areas.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-theme-patterns.js (96%) diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js index 6331afd058de34..8f2003d0e08a27 100644 --- a/packages/core-commands/src/site-editor-navigation-commands.js +++ b/packages/core-commands/src/site-editor-navigation-commands.js @@ -203,7 +203,7 @@ function useSiteEditorBasicNavigationCommands() { icon: symbolFilled, callback: ( { close } ) => { const args = { - path: '/library', + path: '/patterns', }; const targetUrl = addQueryArgs( 'site-editor.php', args ); if ( isSiteEditor ) { diff --git a/packages/edit-site/src/components/create-pattern-modal/index.js b/packages/edit-site/src/components/create-pattern-modal/index.js index 5180ad5d870684..bd83b369c3abb3 100644 --- a/packages/edit-site/src/components/create-pattern-modal/index.js +++ b/packages/edit-site/src/components/create-pattern-modal/index.js @@ -18,7 +18,7 @@ import { useDispatch } from '@wordpress/data'; /** * Internal dependencies */ -import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-library/utils'; +import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils'; export default function CreatePatternModal( { closeModal, diff --git a/packages/edit-site/src/components/page-main/index.js b/packages/edit-site/src/components/page-main/index.js index a6c05886888c45..af017a8db9700a 100644 --- a/packages/edit-site/src/components/page-main/index.js +++ b/packages/edit-site/src/components/page-main/index.js @@ -6,7 +6,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router'; /** * Internal dependencies */ -import PageLibrary from '../page-library'; +import PagePatterns from '../page-patterns'; import PageTemplateParts from '../page-template-parts'; import PageTemplates from '../page-templates'; import { unlock } from '../../lock-unlock'; @@ -22,8 +22,8 @@ export default function PageMain() { return ; } else if ( path === '/wp_template_part/all' ) { return ; - } else if ( path === '/library' ) { - return ; + } else if ( path === '/patterns' ) { + return ; } return null; diff --git a/packages/edit-site/src/components/page-library/grid-item.js b/packages/edit-site/src/components/page-patterns/grid-item.js similarity index 92% rename from packages/edit-site/src/components/page-library/grid-item.js rename to packages/edit-site/src/components/page-patterns/grid-item.js index 726f7a9896adc2..cc9d99fd900136 100644 --- a/packages/edit-site/src/components/page-library/grid-item.js +++ b/packages/edit-site/src/components/page-patterns/grid-item.js @@ -39,7 +39,7 @@ import { useLink } from '../routes/link'; export default function GridItem( { categoryId, composite, icon, item } ) { const instanceId = useInstanceId( GridItem ); - const descriptionId = `edit-site-library__pattern-description-${ instanceId }`; + const descriptionId = `edit-site-patterns__pattern-description-${ instanceId }`; const [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false ); const { __experimentalDeleteReusableBlock } = @@ -61,10 +61,10 @@ export default function GridItem( { categoryId, composite, icon, item } ) { }; const isEmpty = ! item.blocks?.length; - const patternClassNames = classnames( 'edit-site-library__pattern', { + const patternClassNames = classnames( 'edit-site-patterns__pattern', { 'is-placeholder': isEmpty, } ); - const previewClassNames = classnames( 'edit-site-library__preview', { + const previewClassNames = classnames( 'edit-site-patterns__preview', { 'is-inactive': item.type === PATTERNS, } ); @@ -132,14 +132,14 @@ export default function GridItem( { categoryId, composite, icon, item } ) { ) }