-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Improve "switch to draft" placement #50217
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { PanelRow } from '@wordpress/components'; | ||
| import { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor'; | ||
| import { FlexItem } from '@wordpress/components'; | ||
|
|
||
| export default function PostTrash() { | ||
| return ( | ||
| <PostTrashCheck> | ||
| <PanelRow> | ||
| <FlexItem isBlock> | ||
| <PostTrashLink /> | ||
| </PanelRow> | ||
| </FlexItem> | ||
| </PostTrashCheck> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ import { displayShortcut } from '@wordpress/keycodes'; | |
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import PostSwitchToDraftButton from '../post-switch-to-draft-button'; | ||
| import { store as editorStore } from '../../store'; | ||
|
|
||
| /** | ||
|
|
@@ -48,10 +47,8 @@ export default function PostSavedState( { | |
| isDirty, | ||
| isNew, | ||
| isPending, | ||
| isPublished, | ||
| isSaveable, | ||
| isSaving, | ||
| isScheduled, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also we removed these two return values but forgot to remove the keys within the useSelect callback. |
||
| hasPublishAction, | ||
| } = useSelect( | ||
| ( select ) => { | ||
|
|
@@ -106,10 +103,6 @@ export default function PostSavedState( { | |
| return null; | ||
| } | ||
|
|
||
| if ( isPublished || isScheduled ) { | ||
| return <PostSwitchToDraftButton />; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this change is causing a small bug. Now for "published posts", the button is there and it says "Save draft", should we return
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened this #51193 to fix this issue. |
||
|
|
||
| /* translators: button label text should, if possible, be under 16 characters. */ | ||
| const label = isPending ? __( 'Save as pending' ) : __( 'Save draft' ); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,4 @@ | ||
| .editor-post-trash.components-button { | ||
| display: flex; | ||
| justify-content: center; | ||
| margin-top: $grid-unit-05; | ||
| width: 100%; | ||
| display: block; | ||
| } |
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.
It feels like these "FlexItem" elements should move into the
PostStatuscomponent instead of keeping them within the reusablePostTrashandPostSwitchToDraftButtoncomponents?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.
These are not really reusable, I think — it already had a "PanelRow". Moving the flex item to PostStatus means lifting up the logic for display or not displaying each of these, otherwise you end up with an empty flex element that still takes space
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 👍