/** * WordPress dependencies */ import { TextControl } from '@safe-wordpress/components'; import { useSelect, useDispatch } from '@safe-wordpress/data'; import { _x } from '@safe-wordpress/i18n'; /** * Internal dependencies */ import { useIsDisabled } from '../hooks'; import { store as NC_POST_EDITOR } from '../store'; export const PostTitle = (): JSX.Element => { const [ title, setTitle ] = useTitle(); const disabled = useIsDisabled(); return (
setTitle( value ) } placeholder={ _x( 'Title…', 'text', 'nelio-content' ) } />
); }; // ===== // HOOKS // ===== const useTitle = () => { const title = useSelect( ( select ) => select( NC_POST_EDITOR ).getTitle(), [] ); const { setTitle } = useDispatch( NC_POST_EDITOR ); return [ title, setTitle ] as const; };