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

Add partial match support to usePreview helpers isSelected and isHovered #3009

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stekalt
Copy link
Contributor

@stekalt stekalt commented Jan 2, 2025

Description

At the moment the isSelected and isHovered helpers of the usePreview() hook only support the exact comparison of the given URL. This change adds the option to only compare the URL partially by checking if the adminRoute starts with the provided URL.

This change is useful for scenarios like displaying child blocks in components such as accordions, where the exact structure of the child block and therefore the admin route to compare might not be known.

Acceptance criteria

Screenshots/screencasts

Before After
https://github.com/user-attachments/assets/fc6abab1-7b53-4cf4-b571-f7506fdd3ac3 https://github.com/user-attachments/assets/ab1b00ff-38da-4d31-8900-6bb17a671430

Open TODOs/questions

  • Add changeset

Further information

@stekalt stekalt self-assigned this Jan 2, 2025
@auto-assign auto-assign bot requested a review from johnnyomair January 2, 2025 15:46
@stekalt stekalt requested a review from thomasdax98 January 2, 2025 15:47
Copy link
Collaborator

@johnnyomair johnnyomair left a comment

Choose a reason for hiding this comment

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

Please implement an example usage in Demo. You can use the accordion block for this.

@stekalt stekalt force-pushed the add-partial-match-support-to-use-preview-helpers branch from c2e8acd to d5073dc Compare January 15, 2025 09:18
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

2 participants