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

alertlink: refactor to use composition #85700

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

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Feb 21, 2025

Refactor AlertLink to use the actual alert component and improve types. There are quite a few gotchas with this component and its types, and I expect there to be some unwanted behavior out there. This PR highlights all of those issues (see the number of todo comments) and addresses some.

Before:
CleanShot 2025-02-21 at 17 42 11@2x

After
CleanShot 2025-02-21 at 17 42 18@2x

Some, but not all issues include:

  • To wide of a prop definition - you could pass to, href and onClick at the same time, not really knowing which one is used?
  • Unless explicitly set to false, openInNewTab prop would result in the link always being open in a new tab due to the default initializer inside
  • Visual discrepancy from the actual alert component
  • Default margin being set and overriden in some cases. This has been updated to leverage a known pattern that @michellewzhang introduced for the Alert component
  • Lack of tests - we now test for the some basic scenarios
  • if only onClick is set, then a default value of to='/' is set, meaning event propagation likely has to be handled inside the onClick handler, else the navigation will still fire.

@JonasBa JonasBa requested review from a team as code owners February 21, 2025 22:44
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant