-
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
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
d222006
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in d222006.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5481827114
📝 Reported issues:
/test/e2e/specs/editor/blocks/image.spec.js