-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Show Tips toggle Let the user re-enable tips via a Show Tips toggle in the More menu. * Typo: sholud → should
- Loading branch information
1 parent
f0b0aac
commit 879929f
Showing
13 changed files
with
181 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* WordPress Dependencies | ||
*/ | ||
import { withSelect, withDispatch } from '@wordpress/data'; | ||
|
||
/** | ||
* WordPress Dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { compose } from '@wordpress/element'; | ||
import { MenuItem } from '@wordpress/components'; | ||
|
||
function TipsToggle( { onToggle, isActive } ) { | ||
return ( | ||
<MenuItem | ||
icon={ isActive && 'yes' } | ||
isSelected={ isActive } | ||
onClick={ onToggle } | ||
> | ||
{ __( 'Show Tips' ) } | ||
</MenuItem> | ||
); | ||
} | ||
|
||
export default compose( [ | ||
withSelect( ( select ) => ( { | ||
isActive: select( 'core/nux' ).areTipsEnabled(), | ||
} ) ), | ||
withDispatch( ( dispatch, ownProps ) => ( { | ||
onToggle() { | ||
const { disableTips, enableTips } = dispatch( 'core/nux' ); | ||
if ( ownProps.isActive ) { | ||
disableTips(); | ||
} else { | ||
enableTips(); | ||
} | ||
ownProps.onToggle(); | ||
}, | ||
} ) ), | ||
] )( TipsToggle ); |
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
Oops, something went wrong.