-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Deprecate 'Post author' block #55352
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
base: trunk
Are you sure you want to change the base?
Changes from 1 commit
cab6b8e
72e877b
7390397
580fc86
491a15e
a8173e3
e29b59f
91c8592
02a9cdd
400ac2d
1a6962b
f2cec4a
9875c31
d4c68b2
b1e0972
e480533
145bb68
57aea0e
d7171a3
bbf4161
389af04
11ab982
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .wp-block-post-author__transform-button { | ||
| padding: 0 $grid-unit-20 $grid-unit-20 52px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import { migrateToRecommendedBlocks } from './utils'; | ||
|
|
||
| const transforms = { | ||
| to: [ | ||
| { | ||
| type: 'block', | ||
| blocks: [ 'core/group' ], | ||
| transform: ( attributes ) => | ||
| migrateToRecommendedBlocks( attributes ), | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default transforms; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { createBlock } from '@wordpress/blocks'; | ||
| import { __ } from '@wordpress/i18n'; | ||
|
|
||
| /** | ||
| * Generate Author-related blocks based on block attributes. | ||
| * | ||
| * @param {Object} attributes Block's attributes. | ||
| * | ||
| * @return {Object} Generated block. | ||
| */ | ||
| export function migrateToRecommendedBlocks( attributes ) { | ||
| const { | ||
| avatarSize, | ||
| byline, | ||
| showBio, | ||
| isLink, | ||
| linkTarget, | ||
| textAlign, | ||
| style, | ||
| ...restAttributes | ||
| } = attributes; | ||
|
|
||
| return createBlock( | ||
| 'core/group', | ||
| { | ||
| ...restAttributes, | ||
| style: { | ||
| ...style, | ||
| color: { | ||
| ...style?.color, | ||
| // Duotone must be applied to the avatar block. | ||
| duotone: undefined, | ||
| }, | ||
| }, | ||
aaronrobertshaw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| layout: { | ||
| type: 'flex', | ||
| flexWrap: 'nowrap', | ||
| verticalAlignment: 'top', | ||
| }, | ||
|
Comment on lines
+65
to
+69
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. The layout and spacing changes are a bit unexpected when migrating the block. Can we apply some sensible defaults to match the previous spacing?
Contributor
Author
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. The Post Author block also has a Flex layout, but seems to have a 1em right margin between the avatar and the content. Therefore, in a8173e3, this is used as the
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.
Contributor
Author
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. Regarding the width of the block, I think the Post Author block does not have This spacing support for this block was added in #35963, but this PR was before #43243 that recommends adding Originally, I think the Post Author block should also have
Contributor
Author
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. Update: Post Author block now supports borders, as of #64599. At the same time, |
||
| }, | ||
| [ | ||
| showBio && | ||
| createBlock( 'core/avatar', { | ||
aaronrobertshaw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| size: avatarSize, | ||
| style: { | ||
| border: { | ||
| radius: '0px', | ||
| }, | ||
| color: { | ||
| duotone: style?.color?.duotone, | ||
| }, | ||
| }, | ||
| } ), | ||
| createBlock( | ||
| 'core/group', | ||
| { | ||
| style: { | ||
| layout: { | ||
| selfStretch: 'fill', | ||
| flexSize: null, | ||
| }, | ||
| }, | ||
| layout: { | ||
| type: 'flex', | ||
| orientation: 'vertical', | ||
| justifyContent: textAlign, | ||
| }, | ||
| }, | ||
| [ | ||
| createBlock( 'core/paragraph', { | ||
| content: byline, | ||
| placeholder: __( 'Write byline…' ), | ||
| style: { | ||
| typography: { | ||
| fontSize: '0.5em', | ||
| }, | ||
| }, | ||
| } ), | ||
| createBlock( 'core/post-author-name', { | ||
| isLink, | ||
| linkTarget, | ||
| style: { | ||
| typography: { | ||
| fontSize: '1em', | ||
| }, | ||
| }, | ||
| } ), | ||
| createBlock( 'core/post-author-biography', { | ||
| style: { | ||
| typography: { | ||
| fontSize: '0.7em', | ||
| }, | ||
| }, | ||
| } ), | ||
| ] | ||
| ), | ||
| ].filter( Boolean ) | ||
| ); | ||
| } | ||


Uh oh!
There was an error while loading. Please reload this page.