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

Feature/Added prop for passing function when close button is clicked #1118

Closed
wants to merge 3 commits into from

Conversation

sbsangu
Copy link

@sbsangu sbsangu commented May 20, 2024

Fixes

Summary

Added an onButtonClose prop to the Toast component to allow users to define a callback function that gets called when the close button of a toast is clicked. This enhancement improves the flexibility and usability of the toast component by allowing custom behavior to be executed when the close button is pressed.

Changes

  • Updated the Toast component to accept and handle a new onButtonClose prop.
  • Updated the ToastContainer component to pass the onButtonClose prop to each Toast component.
  • Updated TypeScript definitions to include the new onButtonClose prop.

Checklist

  • Forked the repository and created a new branch from master.
  • Ran yarn in the repository root.
  • Added tests to cover the new functionality.
  • Ensured the test suite passes (yarn test).
  • Ran yarn start to test changes in the playground.
  • Updated the readme if needed.
  • Updated the TypeScript definitions if needed.
  • Formatted the code with prettier (yarn prettier-all).
  • Ensured the code lints (yarn lint:fix).

Additional Information

This feature allows users to pass a callback function that will be called when the toast's close button is clicked, enabling more custom and dynamic behaviors when a toast is dismissed.

Copy link

@CalvinJamesHeath CalvinJamesHeath left a comment

Choose a reason for hiding this comment

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

Excellent!

@sbsangu
Copy link
Author

sbsangu commented May 26, 2024

Could you please let me know if this pull request resolves the issue?
Additionally, do you think it is ready to be merged?

README.md Outdated
@@ -107,6 +107,12 @@ Support this project with your organization. Your logo will show up here with a
<a href="https://opencollective.com/react-toastify/organization/8/website"><img src="https://opencollective.com/react-toastify/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/react-toastify/organization/9/website"><img src="https://opencollective.com/react-toastify/organization/9/avatar.svg"></a>

### ToastContainer Props

Choose a reason for hiding this comment

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

I don't think this should be added here, the README seems to contain only high-level information about the project and not detailed release notes.

Choose a reason for hiding this comment

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

Can we delete this? The project is not using package-lock.json.

yarn.lock Outdated

Choose a reason for hiding this comment

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

Can you revert these changes? There doesn't seem to be any good reason for it.

@sbsangu sbsangu closed this Jul 7, 2024
@sbsangu sbsangu deleted the feature/on-button-close branch July 7, 2024 20:20
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.

Feature: prop for passing function when close button is clicked
3 participants