-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FSE: Add welcome guide #36172
Merged
Merged
FSE: Add welcome guide #36172
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3c62719
FSE: Add welcome guide
Mamaduka 03a4a26
Fix e2e tests
Mamaduka 64dc6bf
Split welcome guide
Mamaduka eb9503e
remove extraneous full stop
jameskoster 339fe96
get started
jameskoster 833fb3c
Close styles welcome guide for e2e tests
Mamaduka 597a16a
Add tools menu item
Mamaduka ec69959
Update assets
Mamaduka 78ea3d9
Adjust styles
Mamaduka 4fa6c96
Fix new e2e test
Mamaduka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,63 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useDispatch } from '@wordpress/data'; | ||
import { Guide } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { createInterpolateElement } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import WelcomeGuideImage from './image'; | ||
import { store as editSiteStore } from '../../store'; | ||
|
||
export default function WelcomeGuideEditor() { | ||
const { toggleFeature } = useDispatch( editSiteStore ); | ||
|
||
return ( | ||
<Guide | ||
className="edit-site-welcome-guide" | ||
contentLabel={ __( 'Welcome to the site editor' ) } | ||
finishButtonText={ __( 'Get Started' ) } | ||
onFinish={ () => toggleFeature( 'welcomeGuide' ) } | ||
pages={ [ | ||
{ | ||
image: ( | ||
<WelcomeGuideImage | ||
nonAnimatedSrc="https://s.w.org/images/block-editor/edit-your-site.svg?1" | ||
animatedSrc="https://s.w.org/images/block-editor/edit-your-site.gif?1" | ||
/> | ||
), | ||
content: ( | ||
<> | ||
<h1 className="edit-site-welcome-guide__heading"> | ||
{ __( 'Edit your site' ) } | ||
</h1> | ||
<p className="edit-site-welcome-guide__text"> | ||
{ __( | ||
'Design everything on your site — from the header right down to the footer — using blocks.' | ||
) } | ||
</p> | ||
<p className="edit-site-welcome-guide__text"> | ||
{ createInterpolateElement( | ||
__( | ||
'Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.' | ||
), | ||
{ | ||
StylesIconImage: ( | ||
<img | ||
alt={ __( 'styles' ) } | ||
src="data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" | ||
/> | ||
), | ||
} | ||
) } | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) { | ||
return ( | ||
<picture className="edit-site-welcome-guide__image"> | ||
<source | ||
srcSet={ nonAnimatedSrc } | ||
media="(prefers-reduced-motion: reduce)" | ||
/> | ||
<img src={ animatedSrc } width="312" height="240" alt="" /> | ||
</picture> | ||
); | ||
} |
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,33 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect } from '@wordpress/data'; | ||
import { store as interfaceStore } from '@wordpress/interface'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import WelcomeGuideEditor from './editor'; | ||
import WelcomeGuideStyles from './styles'; | ||
import { store as editSiteStore } from '../../store'; | ||
|
||
export default function WelcomeGuide() { | ||
const { isActive, isStylesOpen } = useSelect( ( select ) => { | ||
const sidebar = select( interfaceStore ).getActiveComplementaryArea( | ||
editSiteStore.name | ||
); | ||
const isStylesSidebar = sidebar === 'edit-site/global-styles'; | ||
const feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide'; | ||
|
||
return { | ||
isActive: select( editSiteStore ).isFeatureActive( feature ), | ||
isStylesOpen: isStylesSidebar, | ||
}; | ||
}, [] ); | ||
|
||
if ( ! isActive ) { | ||
return null; | ||
} | ||
|
||
return isStylesOpen ? <WelcomeGuideStyles /> : <WelcomeGuideEditor />; | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/edit-site/src/components/welcome-guide/style.scss
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,37 @@ | ||
.edit-site-welcome-guide { | ||
width: 312px; | ||
|
||
&__image { | ||
background: #00a0d2; | ||
margin: 0 0 $grid-unit-20; | ||
> img { | ||
display: block; | ||
max-width: 100%; | ||
object-fit: cover; | ||
} | ||
} | ||
|
||
&__heading { | ||
font-family: $default-font; | ||
font-size: 24px; | ||
line-height: 1.4; | ||
margin: $grid-unit-20 0 $grid-unit-20 0; | ||
padding: 0 $grid-unit-40; | ||
} | ||
|
||
&__text { | ||
font-size: $default-font-size; | ||
line-height: 1.4; | ||
margin: 0 0 $grid-unit-20 0; | ||
padding: 0 $grid-unit-40; | ||
|
||
img { | ||
vertical-align: bottom; | ||
} | ||
} | ||
|
||
&__inserter-icon { | ||
margin: 0 4px; | ||
vertical-align: text-top; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@Mamaduka I noticed that if you go into 'Styles' first (having never seen either welcome guide), the 'Welcome to Styles' welcome guide displays as expected.
You might then do some editing with the styles sidebar still open.
But then when you close the styles sidebar you also get the 'Edit your site' welcome guide, which feels out of place.
Not sure what the right solution would be here. 🤔
Maybe the 'Edit your site' welcome guide shouldn't ever show when visiting the Styles link. Or maybe when visiting the Styles link, a Welcome guide that combines both 'Edit your site' and 'Welcome to Styles' should be shown.
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.
@talldan, I agree it's a little confusing.
I can use the query argument
styles=open
for this logic. Or maybe we should combine welcome guides since it's the same screen, just different entry points.We can switch back to separate Welcome Guide modals once the "Global Styles" has a dedicated screen.
@jameskoster, @kellychoffman, what do you think?