Skip to content

feat(author-profile): add block variations for layout selection#2302

Open
rbcorrales wants to merge 5 commits intotrunkfrom
feat/author-profile-variations
Open

feat(author-profile): add block variations for layout selection#2302
rbcorrales wants to merge 5 commits intotrunkfrom
feat/author-profile-variations

Conversation

@rbcorrales
Copy link
Member

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:

  1. Open a post editor in a block theme environment.
  2. Insert a new Author Profile block and verify a layout picker appears with 4 options.
  3. Select each variation and verify the inner blocks match the expected layout.
  4. In the list view and sidebar, verify each variation shows its name (e.g., "Author Profile (Centered)") with a blue icon.
  5. Click "Change layout" in the toolbar and verify the currently active variation is highlighted.
  6. Click a different variation, confirm the dialog appears, accept it, and verify inner blocks are replaced.
  7. Cancel the dialog on a different attempt and verify nothing changes.
  8. Remove some inner blocks, then click "Reset" and verify the block resets to the current variation's full template.
  9. Add the Author Profile block in the site editor and verify the variation picker and layout switching work correctly.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@rbcorrales rbcorrales requested a review from Copilot February 25, 2026 16:13
@rbcorrales rbcorrales changed the title Add block variations for Author Profile layout selection feat(author-profile): add block variations for layout selection Feb 25, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@rbcorrales rbcorrales force-pushed the feat/author-profile-variations branch from 48e08f0 to 8a8a06a Compare February 28, 2026 06:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants