Skip to content
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

Login/out Block: Add button display option #68233

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented Dec 23, 2024

Fixes: #68226

What?

Add a button display option to the Login/out block, allowing users to style the login/logout link as a button instead of just a text link.

Why?

The Login/out block currently only displays as a text link, which may not match the desired visual presentation in all contexts. This enhancement allows users to display the block as a button, providing better visual alignment with other button elements and improving the block's flexibility for various use cases.

Testing Instructions

  1. Create or edit a post/page
  2. Insert a Login/out block
  3. In the block settings sidebar, look for the "Display as a button" toggle under Settings
  4. Toggle the button display on/off
  5. Verify the block updates in the editor to show as a button
  6. Save the post/page
  7. View the post/page on the frontend
  8. Verify the login/logout link appears as a button when enabled
  9. Test both logged-in and logged-out states

Screencast

Screen.Recording.2024-12-23.at.08.53.48.mov

@himanshupathak95 himanshupathak95 marked this pull request as ready for review December 23, 2024 03:34
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @burnuser.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: burnuser.

Co-authored-by: himanshupathak95 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@himanshupathak95
Copy link
Contributor Author

Currently, the button takes full width by default due to the added classes wp-block-button__link wp-element-button. This is consistent with how standalone button blocks behave when first inserted.

As shown in the screencast, we can modify the width by grouping the Login/out block or by using width controls on the group container. Would love to get your thoughts on whether we should keep this default full-width behavior (consistent with the Button block)

Note: I'll address the failing tests once we've confirmed the button design and structure approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make "Login/out" block available as Button
1 participant