-
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.
* UI: Add a fullscreen mode * Consistent return URL * Remove unneccessary calc call * Use the view_items label instead of a generic Close * Fix small phpcs issues
- Loading branch information
1 parent
2065011
commit 93f1f22
Showing
15 changed files
with
172 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,6 +272,10 @@ | |
margin-left: -18px; | ||
} | ||
} | ||
|
||
body.is-fullscreen-mode #{$selector} { | ||
left: 0 !important; | ||
} | ||
} | ||
|
||
/** | ||
|
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,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Component } from '@wordpress/element'; | ||
import { withSelect } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
class FullscreenMode extends Component { | ||
componentDidMount() { | ||
this.sync(); | ||
} | ||
|
||
componentDidUpdate( prevProps ) { | ||
if ( this.props.isActive !== prevProps.isActive ) { | ||
this.sync(); | ||
} | ||
} | ||
|
||
sync() { | ||
const { isActive } = this.props; | ||
if ( isActive ) { | ||
document.body.classList.add( 'is-fullscreen-mode' ); | ||
} else { | ||
document.body.classList.remove( 'is-fullscreen-mode' ); | ||
} | ||
} | ||
|
||
render() { | ||
return null; | ||
} | ||
} | ||
|
||
export default withSelect( ( select ) => ( { | ||
isActive: select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ), | ||
} ) )( FullscreenMode ); |
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,17 @@ | ||
body.is-fullscreen-mode { | ||
// Reset the html.wp-topbar padding | ||
margin-top: -$admin-bar-height-big; | ||
@include break-medium() { | ||
margin-top: -$admin-bar-height; | ||
} | ||
|
||
#adminmenumain, | ||
#wpadminbar { | ||
display: none; | ||
} | ||
|
||
#wpcontent, | ||
#wpfooter { | ||
margin-left: 0; | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
edit-post/components/header/fullscreen-mode-close/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,48 @@ | ||
/** | ||
* External Dependencies | ||
*/ | ||
import { get } from 'lodash'; | ||
|
||
/** | ||
* WordPress Dependencies | ||
*/ | ||
import { withSelect } from '@wordpress/data'; | ||
import { IconButton, Toolbar } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { addQueryArgs } from '@wordpress/url'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
function FullscreenModeClose( { isActive, postType } ) { | ||
if ( ! isActive || ! postType ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Toolbar className="edit-post-fullscreen-mode-close__toolbar"> | ||
<IconButton | ||
icon="no-alt" | ||
href={ addQueryArgs( 'edit.php', { post_type: postType.slug } ) } | ||
label={ get( | ||
postType, | ||
[ 'labels', 'view_items' ], | ||
__( 'View Posts' ) | ||
) } | ||
/> | ||
</Toolbar> | ||
); | ||
} | ||
|
||
export default withSelect( ( select ) => { | ||
const { getCurrentPostType } = select( 'core/editor' ); | ||
const { isFeatureActive } = select( 'core/edit-post' ); | ||
const { getPostType } = select( 'core' ); | ||
|
||
return { | ||
isActive: isFeatureActive( 'fullscreenMode' ), | ||
postType: getPostType( getCurrentPostType() ), | ||
}; | ||
} )( FullscreenModeClose ); |
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,7 @@ | ||
.edit-post-fullscreen-mode-close__toolbar { | ||
border-top: 0; | ||
border-bottom: 0; | ||
border-left: 0; | ||
margin: -9px 10px -9px -10px; | ||
padding: 9px 10px; | ||
} |
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