-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome: Replace the publish dropdown by a sidebar panel #4119
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6c8ddf2
Chrome: Replace the publish dropdown by a sidebar panel
youknowriad 131ab94
Chrome: Allow multiple sidebars
youknowriad 100e210
Chrome: Slide in animation for the publish sidebar
youknowriad ae83845
Chrome: fix hasOpenSidebar selector
youknowriad a8c3906
Chrome: Fix animation speed of the publish sidebar
youknowriad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { connect } from 'react-redux'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { compose } from '@wordpress/element'; | ||
import { withAPIData, PanelBody, IconButton } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal Dependencies | ||
*/ | ||
import './style.scss'; | ||
import PostVisibility from '../post-visibility'; | ||
import PostVisibilityLabel from '../post-visibility/label'; | ||
import PostSchedule from '../post-schedule'; | ||
import PostScheduleLabel from '../post-schedule/label'; | ||
import PostPublishButton from '../post-publish-button'; | ||
import PostSwitchToDraftButton from '../post-switch-to-draft-button'; | ||
import { getCurrentPostType } from '../../store/selectors'; | ||
|
||
function PostPublishPanel( { onClose, user } ) { | ||
const canPublish = user.data && user.data.capabilities.publish_posts; | ||
|
||
return ( | ||
<div className="editor-post-publish-panel"> | ||
<div className="editor-post-publish-panel__header"> | ||
<div className="editor-post-publish-panel__header-publish-button"> | ||
<PostPublishButton onSubmit={ onClose } /> | ||
</div> | ||
<IconButton | ||
onClick={ onClose } | ||
icon="no-alt" | ||
label={ __( 'Close Publish Panel' ) } | ||
/> | ||
</div> | ||
|
||
<div className="editor-post-publish-panel__content"> | ||
<div><strong>{ __( 'All ready to go?' ) }</strong></div> | ||
<p>{ __( 'Here, you can do a last-minute check up of your settings below, before you publish.' ) }</p> | ||
{ ! canPublish && | ||
<div> | ||
<span>{ __( 'Visibility' ) }</span> | ||
<span><PostVisibilityLabel /></span> | ||
</div> | ||
} | ||
{ canPublish && | ||
<PanelBody initialOpen={ false } title={ [ | ||
__( 'Visibility: ' ), | ||
<span className="editor-post-publish-panel__link" key="label"><PostVisibilityLabel /></span>, | ||
] }> | ||
<PostVisibility /> | ||
</PanelBody> | ||
} | ||
{ canPublish && | ||
<PanelBody initialOpen={ false } title={ [ | ||
__( 'Publish: ' ), | ||
<span className="editor-post-publish-panel__link" key="label"><PostScheduleLabel /></span>, | ||
] }> | ||
<PostSchedule /> | ||
</PanelBody> | ||
} | ||
</div> | ||
|
||
<div className="editor-post-publish-panel__footer"> | ||
<PostSwitchToDraftButton /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const applyConnect = connect( | ||
( state ) => { | ||
return { | ||
postType: getCurrentPostType( state ), | ||
}; | ||
}, | ||
); | ||
|
||
const applyWithAPIData = withAPIData( ( props ) => { | ||
const { postType } = props; | ||
|
||
return { | ||
user: `/wp/v2/users/me?post_type=${ postType }&context=edit`, | ||
}; | ||
} ); | ||
|
||
export default compose( [ | ||
applyConnect, | ||
applyWithAPIData, | ||
] )( PostPublishPanel ); |
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 @@ | ||
.editor-post-publish-panel { | ||
background: $white; | ||
color: $dark-gray-500; | ||
} | ||
|
||
.editor-post-publish-panel__content { | ||
padding: 16px; | ||
|
||
.components-panel__body { | ||
margin-left: -16px; | ||
margin-right: -16px; | ||
margin-bottom: -16px; | ||
margin-top: 10px; | ||
border: none; | ||
|
||
.components-panel__body-toggle { | ||
font-weight: normal; | ||
} | ||
} | ||
|
||
.editor-post-visibility__dialog-legend { | ||
display: none; | ||
} | ||
} | ||
|
||
.editor-post-publish-panel__header { | ||
padding-left: 16px; | ||
height: $header-height; | ||
border-bottom: 1px solid $light-gray-500; | ||
display: flex; | ||
align-items: center; | ||
align-content: space-between; | ||
} | ||
|
||
.editor-post-publish-panel__header-publish-button { | ||
flex-grow: 1; | ||
text-align: right; | ||
} | ||
|
||
.editor-post-publish-panel__footer { | ||
padding: 16px; | ||
} | ||
|
||
.wp-core-ui .editor-post-publish-panel__toggle.button-primary { | ||
margin: 0 10px; | ||
display: inline-flex; | ||
align-items: center; | ||
|
||
&.is-busy .dashicon { | ||
display: none; | ||
} | ||
|
||
.dashicon { | ||
margin-right: -4px; | ||
} | ||
} | ||
|
||
.editor-post-publish-panel__link { | ||
color: $blue-medium-700; | ||
text-decoration: underline; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are keyframes local to a CSS file? If not, would this need a
gutenberg_
prefix?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmm good question, I guess this applies to all of our animations. I wonder if there's a way to nest these animations. If not, it makes sense to add a prefix for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @jasmussen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think animations are globally registered, so if registered once it's available everywhere the CSS is loaded.
It'd be nice to either have reusable animations, or well scoped ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! I'm inclined to leave this issue to a separate PR as it's global to all animations.