-
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.
- Loading branch information
Showing
6 changed files
with
106 additions
and
1 deletion.
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
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,56 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { Guide } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import WelcomeGuideImage from './image'; | ||
import { store as editSiteStore } from '../../store'; | ||
|
||
export default function WelcomeGuideTemplate() { | ||
const { toggleFeature } = useDispatch( editSiteStore ); | ||
|
||
const isActive = useSelect( | ||
( select ) => select( editSiteStore ).isFeatureActive( 'welcomeGuide' ), | ||
[] | ||
); | ||
|
||
if ( ! isActive ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Guide | ||
className="edit-site-welcome-guide" | ||
contentLabel={ __( 'Welcome to the site editor' ) } | ||
finishButtonText={ __( 'Try Styles' ) } | ||
onFinish={ () => toggleFeature( 'welcomeGuide' ) } | ||
pages={ [ | ||
{ | ||
image: ( | ||
<WelcomeGuideImage | ||
nonAnimatedSrc="https://s.w.org/images/block-editor/welcome-template-editor.svg" | ||
animatedSrc="https://s.w.org/images/block-editor/welcome-template-editor.gif" | ||
/> | ||
), | ||
content: ( | ||
<> | ||
<h1 className="edit-site-welcome-guide__heading"> | ||
{ __( 'Introducing: Styles' ) } | ||
</h1> | ||
<p className="edit-site-welcome-guide__text"> | ||
{ __( | ||
'Try out and apply new colors, typography, and layout across your entire site. You can also customize the appearance of specific blocks, meaning that all paragraph blocks can appear the same with a few clicks.' | ||
) } | ||
</p> | ||
</> | ||
), | ||
}, | ||
] } | ||
/> | ||
); | ||
} |
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
.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-30 0; | ||
padding: 0 $grid-unit-40; | ||
} | ||
|
||
&__inserter-icon { | ||
margin: 0 4px; | ||
vertical-align: text-top; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const PREFERENCES_DEFAULTS = { | ||
features: {}, | ||
features: { | ||
welcomeGuide: true, | ||
}, | ||
}; |
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