-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ca9c7f
commit 0627b18
Showing
4 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/edit-site/src/components/template-part-modal/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import TemplatePartRenameModal from './rename'; | ||
|
||
export const TEMPLATE_PART_MODALS = { | ||
rename: 'edit-site/template-part-rename', | ||
duplicate: 'edit-site/template-part-duplicate', | ||
}; | ||
|
||
export default function TemplatePartModal() { | ||
// Duplication command and modal is in separate follow-up. | ||
return ( | ||
<> | ||
<TemplatePartRenameModal /> | ||
{ /* <PatternDuplicateModal /> */ } | ||
</> | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/edit-site/src/components/template-part-modal/rename.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { store as interfaceStore } from '@wordpress/interface'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import RenameTemplatePartModal from '../rename-template-part-modal'; | ||
import { TEMPLATE_PART_MODALS } from './'; | ||
import useEditedEntityRecord from '../use-edited-entity-record'; | ||
|
||
export default function TemplatePartRenameModal() { | ||
const { record } = useEditedEntityRecord(); | ||
const { closeModal } = useDispatch( interfaceStore ); | ||
const isActive = useSelect( ( select ) => | ||
select( interfaceStore ).isModalActive( TEMPLATE_PART_MODALS.rename ) | ||
); | ||
|
||
if ( ! isActive ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<RenameTemplatePartModal | ||
onClose={ closeModal } | ||
templatePart={ record } | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters