feat(author-profile): add block variations for layout selection#2302
feat(author-profile): add block variations for layout selection#2302rbcorrales wants to merge 5 commits intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds block variation support to the Author Profile block, enabling publishers to choose from four different layout options when inserting the block in a block theme. The implementation follows WordPress block editor conventions by using the standard block variations API along with custom variation switcher UI for changing layouts after initial selection.
Changes:
- Adds four layout variations (Default, Avatar right, Centered, and Compact) with visual picker UI
- Refactors template definitions into a separate module with shared constants for reusability
- Implements variation switching with confirmation dialog to prevent accidental content loss
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/blocks/author-profile/variations.js | Defines four block variations with custom icons and layout configurations |
| src/blocks/author-profile/templates.js | Extracts and organizes block templates with shared constants for all variations |
| src/blocks/author-profile/index.js | Registers variations with the block |
| src/blocks/author-profile/edit.js | Adds variation picker, switcher modal, and auto-populate logic |
| src/blocks/author-profile/block.json | Adds variation attribute to track selected layout |
| src/blocks/author-profile/editor.scss | Styles for the variation switcher modal UI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
48e08f0 to
8a8a06a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
All Submissions:
Changes proposed in this Pull Request:
When inserting the Author Profile block in a block theme, publishers can now choose from four layout variations: Default (avatar left), Avatar right, Centered, and Compact (no avatar). Each variation provides the same set of author fields so publishers can remove what they don't need without worrying about losing fields they can't add back.
After choosing a layout, a "Change layout" button in the toolbar lets publishers switch to a different variation. A confirmation dialog warns that switching will replace the current block content. A "Reset" button restores the current variation's original layout.
Closes NPPD-1221.
How to test the changes in this Pull Request:
Other information: