https://github.com/thebesttvarynka/yew-notifications
Notifications components library for Yew
https://github.com/thebesttvarynka/yew-notifications
notifications rust toast toast-notifications yew yew-components
Last synced: about 1 month ago
JSON representation
Notifications components library for Yew
- Host: GitHub
- URL: https://github.com/thebesttvarynka/yew-notifications
- Owner: TheBestTvarynka
- License: mit
- Created: 2022-12-11T11:59:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-17T21:29:05.000Z (over 1 year ago)
- Last Synced: 2024-03-17T22:27:41.646Z (over 1 year ago)
- Topics: notifications, rust, toast, toast-notifications, yew, yew-components
- Language: Rust
- Homepage: https://yn-docs.qkation.com/yew_notifications/index.html
- Size: 1.08 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://stand-with-ukraine.pp.ua/)
# yew-notifications
Table of content:
* [Motivation](#motivation)
* [How to use it](#how-to-use-it)
* [Moving forward](#moving-forward)
* [Meta](#meta)
* [Contributing](#contributing)Notifications components library for [Yew](https://yew.rs/). It's like [react-toastify](https://www.npmjs.com/package/react-toastify) but for [yew](https://yew.rs/) and more simpler (so far :smirk:).

Documentation: https://docs.rs/yew-notifications/

[:arrow_up: demo site](https://yn-docs.qkation.com/examples/basic/index.html)

[:arrow_up: demo site](https://yn-docs.qkation.com/examples/terminal/index.html)
Where it already used?
* [crypto-helper](https://crypto.qkation.com/)
### Motivation
I was writing my personal project [crypto-helper](https://github.com/TheBestTvarynka/crypto-helper/) some time ago. I was forced to write [awful code](https://github.com/TheBestTvarynka/crypto-helper/blob/8ad5ca3180925120a6f7ceb39253000f7ce3f447/src/notification.rs) to add some notifications functionality to my web app. So, I decided to write this library that allows the easy showing of notifications to users.
Inspired by `yew-toastrack`: https://github.com/kinnison/linkdoku/tree/main/yew-toastrack .
### How to use it
1. Decide which notification components to use. `yew-notifications` implements standard (default) notifications but you can write your own. See [`basic`](https://github.com/TheBestTvarynka/yew-notifications/tree/main/examples/basic) and [`custom`](https://github.com/TheBestTvarynka/yew-notifications/tree/main/examples/custom) examples for more information.
```toml
# Cargo.toml# if you want to use standard notification components
yew-notifications = { version = "0.2", features = ["standard-notification"] }# if you decide to write and use custom notification components
yew-notifications = "0.2"
```2. Wrap needed components into `NotificationProvider`:
```rust
// Notification, NotificationFactory - your notification types.
// They can be imported from this library or written by yourself (see `custom` example).
// component_creator is an instance of the NotificationFactory
{component_creator}>
// some inner components
>
```3. Spawn notifications:
```rust
use yew_notifications::use_notification;// Notification - your notification type.
// It can be imported from this library or written by yourself (see `custom` example).
let notifications_manager = use_notification::();
notifications_manager.spawn(Notification::new(...));
```See the [`examples`](/examples/) directory for the code examples.
### Moving forward
At this point, this library has minimal functionality implemented. I plan to improve it continuously according to my needs. If you have any feature requests, then create an issue with the description. It'll be a priority for me.
### Meta
[Pavlo Myroniuk](https://github.com/TheBestTvarynka) - [[email protected]](mailto:[email protected]).
Distributed under the [MIT](https://github.com/TheBestTvarynka/yew-notifications/blob/main/LICENSE) license.
### Contributing
Feel free to contribute.
1. Fork it ()
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request