Skip to content

Commit

Permalink
Site Editor: Add the Post Author component to the Page sidebar (WordP…
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Nov 21, 2023
1 parent ffa9ff7 commit 3e42c03
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 41 deletions.
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 }>
<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>
</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

0 comments on commit 3e42c03

Please sign in to comment.