-
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.
* FSE: Add welcome guide * Fix e2e tests * Split welcome guide * remove extraneous full stop * get started * Close styles welcome guide for e2e tests * Add tools menu item * Update assets * Adjust styles * Fix new e2e test Co-authored-by: James Koster <[email protected]>
- Loading branch information
1 parent
c6594e7
commit b697aa0
Showing
20 changed files
with
346 additions
and
2 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
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.