fossology / FOSSologyUI

Repository to hold the new UI framework for FOSSology built with React
https://fossology.github.io/FOSSologyUI/
GNU General Public License v2.0
49 stars 88 forks source link

feat(alert-hook): added alert hook to display danger and success snac… #186

Open pushkarsaneja opened 2 years ago

pushkarsaneja commented 2 years ago

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

GMishx commented 2 years ago

@Shruti3004 @sjha2048 can you please look into this PR?

GMishx commented 2 years ago

@pushkarsaneja can you please rebase the branch with latest main to resolve the merge conflict?

Rbcoder1 commented 2 years ago

i would like to contribute in this issue. can i solved it?

viv9k commented 1 year ago

Test is needed for this, fixed merge conflict