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
[x] Forked the repository and created a new branch from master.
[x] Ran yarn in the repository root.
[x] Added tests to cover the new functionality.
[x] Ensured the test suite passes (yarn test).
[x] Ran yarn start to test changes in the playground.
[x] Updated the readme if needed.
[x] Updated the TypeScript definitions if needed.
[x] Formatted the code with prettier (yarn prettier-all).
[x] 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.
Fixes
Summary
Added an
onButtonClose
prop to theToast
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
Toast
component to accept and handle a newonButtonClose
prop.ToastContainer
component to pass theonButtonClose
prop to eachToast
component.onButtonClose
prop.Checklist
master
.yarn
in the repository root.yarn test
).yarn start
to test changes in the playground.yarn prettier-all
).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.