-
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.
Page Content Focus: Add welcome guides (#52014)
* Page Content Focus: Add welcome guides * Don't show when editor guide is active * Just use regular accent/theme color in all guides * slight copy change page guide * Update components changelog * Disable new guides in E2E tests * Use s.w.org videos --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
- Loading branch information
1 parent
ad1865a
commit 3efbff4
Showing
13 changed files
with
219 additions
and
100 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
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
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
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
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
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
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
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
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,75 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { Guide } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { store as preferencesStore } from '@wordpress/preferences'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { store as editSiteStore } from '../../store'; | ||
|
||
export default function WelcomeGuidePage() { | ||
const { toggle } = useDispatch( preferencesStore ); | ||
|
||
const isVisible = useSelect( ( select ) => { | ||
const isPageActive = !! select( preferencesStore ).get( | ||
'core/edit-site', | ||
'welcomeGuidePage' | ||
); | ||
const isEditorActive = !! select( preferencesStore ).get( | ||
'core/edit-site', | ||
'welcomeGuide' | ||
); | ||
const { hasPageContentFocus } = select( editSiteStore ); | ||
return isPageActive && ! isEditorActive && hasPageContentFocus(); | ||
}, [] ); | ||
|
||
if ( ! isVisible ) { | ||
return null; | ||
} | ||
|
||
const heading = __( 'Editing your page' ); | ||
|
||
return ( | ||
<Guide | ||
className="edit-site-welcome-guide guide-page" | ||
contentLabel={ heading } | ||
finishButtonText={ __( 'Continue' ) } | ||
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuidePage' ) } | ||
pages={ [ | ||
{ | ||
image: ( | ||
<video | ||
className="edit-site-welcome-guide__video" | ||
autoPlay | ||
loop | ||
muted | ||
width="312" | ||
height="240" | ||
> | ||
<source | ||
src="https://s.w.org/images/block-editor/editing-your-page.mp4" | ||
type="video/mp4" | ||
/> | ||
</video> | ||
), | ||
content: ( | ||
<> | ||
<h1 className="edit-site-welcome-guide__heading"> | ||
{ heading } | ||
</h1> | ||
<p className="edit-site-welcome-guide__text"> | ||
{ __( | ||
'We’ve recently introduced the ability to edit pages within the site editor. You can switch to editing your template using the settings sidebar.' | ||
) } | ||
</p> | ||
</> | ||
), | ||
}, | ||
] } | ||
/> | ||
); | ||
} |
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
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
Oops, something went wrong.