diff --git a/packages/edit-site/src/components/template-details/edit-template-title.js b/packages/edit-site/src/components/template-details/edit-template-title.js new file mode 100644 index 0000000000000..386851e15c22b --- /dev/null +++ b/packages/edit-site/src/components/template-details/edit-template-title.js @@ -0,0 +1,28 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { TextControl } from '@wordpress/components'; +import { useEntityProp } from '@wordpress/core-data'; + +export default function EditTemplateTitle( { template } ) { + const [ title, setTitle ] = useEntityProp( + 'postType', + template.type, + 'title', + template.id + ); + + return ( + { + setTitle( newTitle || template.slug ); + } } + /> + ); +} diff --git a/packages/edit-site/src/components/template-details/index.js b/packages/edit-site/src/components/template-details/index.js index 7de495fd09324..9467c12f9ba6a 100644 --- a/packages/edit-site/src/components/template-details/index.js +++ b/packages/edit-site/src/components/template-details/index.js @@ -24,6 +24,7 @@ import { } from '../navigation-sidebar/navigation-panel/constants'; import { store as editSiteStore } from '../../store'; import TemplateAreas from './template-areas'; +import EditTemplateTitle from './edit-template-title'; export default function TemplateDetails( { template, onClose } ) { const { title, description } = useSelect( @@ -55,13 +56,17 @@ export default function TemplateDetails( { template, onClose } ) { return (
- - { title } - + { template.is_custom ? ( + + ) : ( + + { title } + + ) } { description && (