-
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.
Widgets Customizer: Add Welcome messaging (#31968)
* Widgets Customizer: Add Welcome component * Widgets Customizer: Show different message when new user and area contains entirely blocks * Widgets Customizer: Rename Welcome to WelcomeGuide and hook it up to welcomeGuide setting * Disable welcome guide in Widgets Customizer E2E tests * Adjust line heights and margins in Customizer WelcomeGuide
- Loading branch information
1 parent
1103f7b
commit 4e42e00
Showing
6 changed files
with
158 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
16 changes: 16 additions & 0 deletions
16
packages/customize-widgets/src/components/welcome-guide/images.js
Large diffs are not rendered by default.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/customize-widgets/src/components/welcome-guide/index.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,72 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Button, ExternalLink } from '@wordpress/components'; | ||
import { useDispatch } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { EditorImage } from './images'; | ||
import { store as customizeWidgetsStore } from '../../store'; | ||
|
||
export default function WelcomeGuide( { sidebar } ) { | ||
const { __unstableToggleFeature: toggleFeature } = useDispatch( | ||
customizeWidgetsStore | ||
); | ||
|
||
const isEntirelyBlockWidgets = sidebar | ||
.getWidgets() | ||
.every( ( widget ) => widget.id.startsWith( 'block-' ) ); | ||
|
||
return ( | ||
<div className="customize-widgets-welcome-guide"> | ||
<EditorImage /> | ||
<h1 className="customize-widgets-welcome-guide__heading"> | ||
{ __( 'Welcome to block Widgets' ) } | ||
</h1> | ||
<p className="customize-widgets-welcome-guide__text"> | ||
{ isEntirelyBlockWidgets | ||
? __( | ||
'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.' | ||
) | ||
: __( | ||
'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.' | ||
) } | ||
</p> | ||
<Button | ||
className="customize-widgets-welcome-guide__button" | ||
isPrimary | ||
onClick={ () => toggleFeature( 'welcomeGuide' ) } | ||
> | ||
{ __( 'Got it' ) } | ||
</Button> | ||
<hr className="customize-widgets-welcome-guide__separator" /> | ||
{ ! isEntirelyBlockWidgets && ( | ||
<p className="customize-widgets-welcome-guide__more-info"> | ||
{ __( 'Want to stick with the old widgets?' ) } | ||
<br /> | ||
<ExternalLink | ||
href={ __( | ||
'https://wordpress.org/plugins/classic-widgets/' | ||
) } | ||
> | ||
{ __( 'Get the Classic Widgets plugin.' ) } | ||
</ExternalLink> | ||
</p> | ||
) } | ||
<p className="customize-widgets-welcome-guide__more-info"> | ||
{ __( 'New to the block editor?' ) } | ||
<br /> | ||
<ExternalLink | ||
href={ __( | ||
'https://wordpress.org/support/article/wordpress-editor/' | ||
) } | ||
> | ||
{ __( "Here's a detailed guide." ) } | ||
</ExternalLink> | ||
</p> | ||
</div> | ||
); | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/customize-widgets/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,45 @@ | ||
.customize-widgets-welcome-guide { | ||
&__image { | ||
background: #00a0d2; | ||
height: 240px; | ||
margin: 0 0 $grid-unit-10; | ||
|
||
&__prm-r { | ||
display: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: reduce) { | ||
&__prm-r { | ||
display: block; | ||
} | ||
|
||
&__prm-np { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
// Extra specificity to override `.wrap h1` styles. | ||
.wrap &__heading { | ||
font-size: 18px; | ||
font-weight: 600; | ||
} | ||
|
||
&__text { | ||
line-height: 1.7; | ||
} | ||
|
||
&__button { | ||
justify-content: center; | ||
margin: 1em 0; | ||
width: 100%; | ||
} | ||
|
||
&__separator { | ||
margin: 1em 0; | ||
} | ||
|
||
&__more-info { | ||
line-height: 1.4; | ||
} | ||
} |
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