-
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.
add hint to show template part move (#52395)
- Loading branch information
1 parent
65fb4cd
commit c845c41
Showing
3 changed files
with
94 additions
and
40 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
36 changes: 36 additions & 0 deletions
36
packages/edit-site/src/components/sidebar-navigation-screen-main/template-part-hint.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,36 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Notice } from '@wordpress/components'; | ||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { store as preferencesStore } from '@wordpress/preferences'; | ||
|
||
const PREFERENCE_NAME = 'isTemplatePartMoveHintVisible'; | ||
|
||
export default function TemplatePartHint() { | ||
const showTemplatePartHint = useSelect( | ||
( select ) => | ||
select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true, | ||
[] | ||
); | ||
|
||
const { set: setPreference } = useDispatch( preferencesStore ); | ||
if ( ! showTemplatePartHint ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Notice | ||
politeness="polite" | ||
className="edit-site-sidebar__notice" | ||
onRemove={ () => { | ||
setPreference( 'core', PREFERENCE_NAME, false ); | ||
} } | ||
> | ||
{ __( | ||
'Looking for template parts? You can now find them in the new "Patterns" page.' | ||
) } | ||
</Notice> | ||
); | ||
} |
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