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

restore old Alert api #1515

Merged
merged 6 commits into from
Aug 23, 2023
Merged

restore old Alert api #1515

merged 6 commits into from
Aug 23, 2023

Conversation

mayank99
Copy link
Contributor

@mayank99 mayank99 commented Aug 22, 2023

Changes

similar to #1502, brought back the old Alert api, reverting the breaking change from #1247.

the following two snippets are now equivalent:

<Alert
  type='positive'
  onClose={onClose}
  clickableText='Click me'
  clickableTextProps={{ href: '/' }}
>
  This is an alert.
</Alert>
<Alert.Wrapper type='positive'>
  <Alert.Icon />
  <Alert.Message>
    This is an alert.
    <Alert.Action href='/'>Click me</Alert.Action>
  </Alert.Message>
  <Alert.CloseButton onClick={onClose} />
</Alert.Wrapper>

Other notes:

  • added missing ButtonBase (from make disabled buttons interactable #1461) to Alert.Action
  • the clickableText, clickableTextProps and onClose props have been brought back but are still deprecated to encourage use of new api.
    • the purpose of restoring the old api in this case is just to make migration easier. clickableText is not a good api so it should be avoided.

Testing

Tested in playground, and added one unit test for legacy api.

Docs

Updated old changeset and old examples in website. Didn't add legacy api example to docs, to encourage new api.

Will update migration guide.

@mayank99 mayank99 self-assigned this Aug 22, 2023
@mayank99 mayank99 marked this pull request as ready for review August 22, 2023 15:39
@mayank99 mayank99 requested review from a team as code owners August 22, 2023 15:39
@mayank99 mayank99 requested review from gretanausedaite and siddhantrawal and removed request for a team August 22, 2023 15:39
Co-authored-by: Rohan Kadkol <45748283+rohan-kadkol@users.noreply.github.com>
@mayank99 mayank99 merged commit f79ed42 into dev Aug 23, 2023
@mayank99 mayank99 deleted the mayank/alert-legacy-api branch August 23, 2023 15:29
@mayank99 mayank99 mentioned this pull request Aug 23, 2023
24 tasks
@mayank99 mayank99 added this to the React 3.0 milestone Aug 23, 2023
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.

4 participants