diff --git a/packages/edit-site/src/components/sidebar/template-card/template-areas.js b/packages/edit-site/src/components/sidebar/template-card/template-areas.js
index 7762812fad558f..61f35717fa7a96 100644
--- a/packages/edit-site/src/components/sidebar/template-card/template-areas.js
+++ b/packages/edit-site/src/components/sidebar/template-card/template-areas.js
@@ -6,7 +6,7 @@ import {
Button,
__experimentalHeading as Heading,
} from '@wordpress/components';
-import { getTemplatePartIcon } from '@wordpress/editor';
+import { store as editorStore } from '@wordpress/editor';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';
@@ -14,19 +14,31 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import { store as editSiteStore } from '../../../store';
-import { TEMPLATE_PART_AREA_TO_NAME } from '../../../store/constants';
function TemplateAreaItem( { area, clientId } ) {
const { selectBlock, toggleBlockHighlight } = useDispatch(
blockEditorStore
);
+ const templatePartArea = useSelect(
+ ( select ) => {
+ const defaultAreas = select(
+ editorStore
+ ).__experimentalGetDefaultTemplatePartAreas();
+
+ return defaultAreas.find(
+ ( defaultArea ) => defaultArea.area === area
+ );
+ },
+ [ area ]
+ );
+
const highlightBlock = () => toggleBlockHighlight( clientId, true );
const cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );
return (
);
}
diff --git a/packages/edit-site/src/components/template-details/template-areas.js b/packages/edit-site/src/components/template-details/template-areas.js
index 153481b02741b6..78e88f95476ada 100644
--- a/packages/edit-site/src/components/template-details/template-areas.js
+++ b/packages/edit-site/src/components/template-details/template-areas.js
@@ -4,7 +4,7 @@
import { sprintf, __ } from '@wordpress/i18n';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
-import { getTemplatePartIcon } from '@wordpress/editor';
+import { store as editorStore } from '@wordpress/editor';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { moreVertical } from '@wordpress/icons';
@@ -12,7 +12,6 @@ import { moreVertical } from '@wordpress/icons';
* Internal dependencies
*/
import { store as editSiteStore } from '../../store';
-import { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';
import isTemplateRevertable from '../../utils/is-template-revertable';
function TemplatePartItemMore( {
@@ -67,6 +66,18 @@ function TemplatePartItem( {
const { selectBlock, toggleBlockHighlight } = useDispatch(
blockEditorStore
);
+ const templatePartArea = useSelect(
+ ( select ) => {
+ const defaultAreas = select(
+ editorStore
+ ).__experimentalGetDefaultTemplatePartAreas();
+
+ return defaultAreas.find(
+ ( defaultArea ) => defaultArea.area === templatePart.area
+ );
+ },
+ [ templatePart.area ]
+ );
const highlightBlock = () => toggleBlockHighlight( clientId, true );
const cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );
@@ -77,7 +88,7 @@ function TemplatePartItem( {
>