-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Comment Avatar Core Block #35396
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @c4rl0sbr4v0! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
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.
Nice work. I left some minor comments related to the code.
You will have to add test fixtures for the new block as noted in the failing unit test:
You can find more details at https://github.com/WordPress/gutenberg/tree/trunk/test/integration/fixtures/blocks#readme.
53efec3
to
a8d299d
Compare
f202621
to
4097c19
Compare
4097c19
to
be0da2d
Compare
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 looks like the only remaining decision is to settle on how we handle avatar sizes.
The other concern is how to deal with backward compatibility challenges related to the fact that get_avatar
function uses hooks internally. The HTML code in the editor might differ with what PHP outputs.
Looking great. A couple of thoughts on this one: Since we have padding and radius, should we also include a background color option, and border controls? These seem to go hand in hand and will give themers the flexibility to create really interesting styles. The name feels a little awkward, should it be "Comment Author Avatar" or "Commenter Avatar"? 🤔 |
8341388
to
c16b851
Compare
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.
When testing with Safari (macOS), something doesn't work as expected for the block. After I insert the block and move focus to another block (or refresh the page), I'm no longer able to edit the block.
Screen.Recording.2021-10-18.at.17.05.30.mov
commentId | ||
); | ||
const containerRef = useRef(); | ||
const clientWidth = useClientWidth( containerRef ); |
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.
Does this value depend on the size of the screen? Won't it change when you resize the size of the browser?
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.
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's taking the max width of the container. Should we put instead a fixed value?
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 don't see my comment. I don't know what would be the best here, but one thing is clear. The max value shouldn't depend on the editor's size max width available.
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 will put as maximum the same we have for images, maximum avatar size * 2.5
alt={ `${ authorName } ${ __( 'Avatar' ) }` } | ||
/> | ||
</ResizableBox> | ||
) : null } |
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.
Should it have a fallback when there is no avatar? Some sort of general placeholder?
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.
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.
Right, but when there are no avatars after fetching is complete, we should also have this fallback included.
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.
What should we put as fallback? A text?
I will take a look if we can put the default image in an easy way.
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.
The image. I even wonder whether it should be resizable.
That should be fixed. It was due to the lack of a div before the resize component. Could you please check it again? I could not reproduce it completely. |
I had code from 1 hour, so it might be that. I will retest tomorrow 👍🏻 |
710147a
to
5729707
Compare
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.
We still need to improve how the block can be selected when it occupies the full row. In practice, it might be a less popular option. I suspect that many designs will prefer to use a group block with a flex layout to have a few similar blocks in one line.
Anyway. I think that this PR is good enough to start testing it with other blocks necessary for the Comments Loop block.
This is the follow-up of a previous PR that was not following the workflow standards.
Replaces #35180.
Closes #30575.
More info on issue #30575.
Description
We are creating a new Comment Avatar Block. The user will be able to adjust the size, border-radius and padding of the Avatar component of all comments on its site by using the FSE template editor.
This component will be loaded by the parent component Query Loop Block, as part of the Comment Template. We have also more information on this tracking issue.
Loom of the last iteration:
https://www.loom.com/share/60f7c06c6acc4a5995f07beab75b359d
How has this been tested?
WordPress Version: 5.8.1
Gutenberg Version: 11.6.0-rc.1
Database: MySQL 8.0.16
Web Server: nginx
PHP Version: 7.3.5
Screenshots
Types of changes
Type Experimental
New feature Site Editor
Needs Accessibility Feedback (Although I tried with both keyboard and voice over and seems to be fine)
Needs Testing
Checklist: