FOSSologyUI
FOSSologyUI copied to clipboard
feat(alert-hook): added alert hook to display danger and success snac…
References to the issues
#157 #155 #154 #180
Description
useAlert hook to display success and danger snackbars. The alert message disappears after 5 seconds or if the user closes the alert message.
Changes
Added an AlertProvider component that provides a useAlert() hook which uses react context under the hood. The hook returns a function alertUser(message,type) which accepts message and type as parameters.
Implementation
The alertUser() is implemented in Pages>Home>index.jsx at line 80 and 88. Other Alerts can be changed to use hooks as well (will do it after the code is reviewed).
https://user-images.githubusercontent.com/83173777/158048302-0c07cea4-b10c-4468-8f71-c626625ddf1a.mp4
@Shruti3004 @sjha2048 can you please look into this PR?
@pushkarsaneja can you please rebase the branch with latest main to resolve the merge conflict?
i would like to contribute in this issue. can i solved it?
Test is needed for this, fixed merge conflict