-
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.
1 parent
26795ca
commit 9aed3a9
Showing
18 changed files
with
199 additions
and
120 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
36 changes: 0 additions & 36 deletions
36
packages/edit-post/src/components/options-modal/options/deferred.js
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
packages/edit-post/src/components/options-modal/options/enable-tips.js
This file was deleted.
Oops, something went wrong.
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
61 changes: 61 additions & 0 deletions
61
packages/edit-post/src/components/welcome-guide-modal/guide.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,61 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState, Children } from '@wordpress/element'; | ||
import { Button } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PageControl from './page-control'; | ||
|
||
function Guide( { onRequestClose, children } ) { | ||
const [ currentPage, setCurrentPage ] = useState( 0 ); | ||
|
||
const numberOfPages = Children.count( children ); | ||
const canGoBack = currentPage > 0; | ||
const canGoForward = currentPage < numberOfPages - 1; | ||
|
||
const goBack = () => { | ||
setCurrentPage( currentPage - 1 ); | ||
}; | ||
|
||
const goForward = () => { | ||
setCurrentPage( currentPage + 1 ); | ||
}; | ||
|
||
return ( | ||
<> | ||
{ children[ currentPage ] } | ||
<div> | ||
{ canGoBack && ( | ||
<Button onClick={ goBack }>{ __( 'Previous' ) }</Button> | ||
) } | ||
<PageControl | ||
currentPage={ currentPage } | ||
numberOfPages={ numberOfPages } | ||
setCurrentPage={ setCurrentPage } | ||
/> | ||
{ canGoForward && ( | ||
<Button onClick={ goForward }>{ __( 'Next' ) }</Button> | ||
) } | ||
{ ! canGoForward && ( | ||
<Button onClick={ onRequestClose }>{ __( 'Get started' ) }</Button> | ||
) } | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
function Page( { children } ) { | ||
return ( | ||
<div> | ||
{ children } | ||
</div> | ||
); | ||
} | ||
|
||
Guide.Page = Page; | ||
|
||
export default Guide; |
13 changes: 13 additions & 0 deletions
13
packages/edit-post/src/components/welcome-guide-modal/images.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,13 @@ | ||
export function BlockEditorSVG() { | ||
return null; | ||
} | ||
|
||
export function BlockSVG() { | ||
return null; | ||
} | ||
|
||
export function BlockLibrarySVG() { | ||
return null; | ||
} | ||
|
||
export const inserterIconHTML = ''; |
65 changes: 65 additions & 0 deletions
65
packages/edit-post/src/components/welcome-guide-modal/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,65 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect, useDispatch } from '@wordpress/data'; | ||
import { Modal } from '@wordpress/components'; | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Guide from './guide'; | ||
import { BlockEditorSVG, BlockSVG, BlockLibrarySVG, inserterIconHTML } from './images'; | ||
|
||
export default function WelcomeGuideModal() { | ||
const isOpen = useSelect( ( select ) => | ||
select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' ) ); | ||
|
||
const { toggleFeature } = useDispatch( 'core/edit-post' ); | ||
|
||
if ( ! isOpen ) { | ||
return null; | ||
} | ||
|
||
const closeModal = () => { | ||
toggleFeature( 'welcomeGuide' ); | ||
}; | ||
|
||
return ( | ||
<Modal title={ __( 'Welcome to the block editor' ) } onRequestClose={ closeModal }> | ||
<Guide onRequestClose={ closeModal }> | ||
<Guide.Page> | ||
<BlockEditorSVG /> | ||
<div> | ||
<h1>{ __( 'Welcome to the block editor' ) }</h1> | ||
<p> | ||
{ __( 'In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.' ) } | ||
</p> | ||
</div> | ||
</Guide.Page> | ||
<Guide.Page> | ||
<BlockSVG /> | ||
<div> | ||
<h1>{ __( 'Make each block your own' ) }</h1> | ||
<p> | ||
{ __( 'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.' ) } | ||
</p> | ||
</div> | ||
</Guide.Page> | ||
<Guide.Page> | ||
<BlockLibrarySVG /> | ||
<div> | ||
<h1>{ __( 'Get to know the block library' ) }</h1> | ||
<p dangerouslySetInnerHTML={ { | ||
__html: sprintf( | ||
/* translators: %s: HTML which displays the inserter icon. */ | ||
__( 'All of the blocks available to you live in the Block Library. You’ll find it wherever you see the %s icon.' ), | ||
inserterIconHTML | ||
), | ||
} } /> | ||
</div> | ||
</Guide.Page> | ||
</Guide> | ||
</Modal> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/edit-post/src/components/welcome-guide-modal/page-control.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,23 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { times } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { IconButton } from '@wordpress/components'; | ||
|
||
export default function PageControl( { currentPage, numberOfPages, setCurrentPage } ) { | ||
return ( | ||
<div> | ||
{ times( numberOfPages, ( page ) => ( | ||
<IconButton | ||
key={ page } | ||
icon={ page === currentPage ? 'foo' : 'bar' } | ||
onClick={ () => setCurrentPage( page ) } | ||
/> | ||
) ) } | ||
</div> | ||
); | ||
} |
Empty file.
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/edit-post/src/plugins/welcome-guide-menu-item/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,16 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useDispatch } from '@wordpress/data'; | ||
import { MenuItem } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export default function WelcomeGuideMenuItem() { | ||
const { toggleFeature } = useDispatch( 'core/edit-post' ); | ||
|
||
return ( | ||
<MenuItem onClick={ () => toggleFeature( 'welcomeGuide' ) }> | ||
{ __( 'Welcome Guide' ) } | ||
</MenuItem> | ||
); | ||
} |
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