Skip to content
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

Site Editor: Add the Post Author component to the Page sidebar #56368

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions packages/edit-post/src/components/sidebar/post-author/index.js

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import {
PostAuthorPanel,
PostSchedulePanel,
PostSwitchToDraftButton,
PostSyncStatus,
Expand All @@ -20,7 +21,6 @@ import {
import PostVisibility from '../post-visibility';
import PostTrash from '../post-trash';
import PostSticky from '../post-sticky';
import PostAuthor from '../post-author';
import PostSlug from '../post-slug';
import PostFormat from '../post-format';
import PostPendingStatus from '../post-pending-status';
Expand Down Expand Up @@ -69,7 +69,7 @@ export default function PostStatus() {
<PostPendingStatus />
<PostFormat />
<PostSlug />
<PostAuthor />
<PostAuthorPanel />
{ fills }
<HStack
style={ {
Expand Down
1 change: 0 additions & 1 deletion packages/edit-post/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@import "./components/secondary-sidebar/style.scss";
@import "./components/sidebar/style.scss";
@import "./components/sidebar/last-revision/style.scss";
@import "./components/sidebar/post-author/style.scss";
@import "./components/sidebar/post-format/style.scss";
@import "./components/sidebar/post-slug/style.scss";
@import "./components/sidebar/post-template/style.scss";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* WordPress dependencies
*/
import { __experimentalVStack as VStack } from '@wordpress/components';
import { PostURLPanel, PostSchedulePanel } from '@wordpress/editor';
import {
PostAuthorPanel,
PostURLPanel,
PostSchedulePanel,
} from '@wordpress/editor';

/**
* Internal dependencies
Expand All @@ -18,7 +22,7 @@ export default function PageSummary( {
postType,
} ) {
return (
<VStack>
<VStack spacing={ 0 }>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This small change is independent but it just removes the spacing between the different controls to match the post editor.

<PageStatus
status={ status }
date={ date }
Expand All @@ -29,6 +33,7 @@ export default function PageSummary( {
<PostSchedulePanel />
<EditTemplate />
<PostURLPanel />
<PostAuthorPanel />
</VStack>
);
}
1 change: 1 addition & 0 deletions packages/editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export { default as PageAttributesParent } from './page-attributes/parent';
export { default as PageTemplate } from './post-template';
export { default as PostAuthor } from './post-author';
export { default as PostAuthorCheck } from './post-author/check';
export { default as PostAuthorPanel } from './post-author/panel';
export { default as PostComments } from './post-comments';
export { default as PostExcerpt } from './post-excerpt';
export { default as PostExcerptCheck } from './post-excerpt/check';
Expand Down
18 changes: 18 additions & 0 deletions packages/editor/src/components/post-author/panel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Internal dependencies
*/
import PostAuthorCheck from './check';
import PostAuthorForm from './index';
import PostPanelRow from '../post-panel-row';

export function PostAuthor() {
return (
<PostAuthorCheck>
<PostPanelRow className="editor-post-author__panel">
<PostAuthorForm />
</PostPanelRow>
</PostAuthorCheck>
);
}

export default PostAuthor;
7 changes: 7 additions & 0 deletions packages/editor/src/components/post-author/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.editor-post-author__panel {
padding-top: $grid-unit-10;
}

.editor-post-author__panel .editor-post-panel__row-control > div {
width: 100%;
}
14 changes: 3 additions & 11 deletions packages/editor/src/components/post-panel-row/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@ const PostPanelRow = forwardRef( ( { className, label, children }, ref ) => {
className={ classnames( 'editor-post-panel__row', className ) }
ref={ ref }
>
{ label ? (
<>
<div className="editor-post-panel__row-label">
{ label }
</div>
<div className="editor-post-panel__row-control">
{ children }
</div>
</>
) : (
children
{ label && (
<div className="editor-post-panel__row-label">{ label }</div>
) }
<div className="editor-post-panel__row-control">{ children }</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change here is a simplification that also makes the "pending" toggle look better spaced in the post editor.

</HStack>
);
} );
Expand Down
3 changes: 3 additions & 0 deletions packages/editor/src/components/post-panel-row/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@

.editor-post-panel__row-control {
flex-grow: 1;
min-height: $button-size;
display: flex;
align-items: center;
}
1 change: 1 addition & 0 deletions packages/editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import "./components/editor-notices/style.scss";
@import "./components/entities-saved-states/style.scss";
@import "./components/error-boundary/style.scss";
@import "./components/post-author/style.scss";
@import "./components/post-excerpt/style.scss";
@import "./components/post-featured-image/style.scss";
@import "./components/post-format/style.scss";
Expand Down
Loading