Code Monkey home page Code Monkey logo

yew-notifications's Introduction

Stand With Ukraine

yew-notifications

Table of content:

Notifications components library for Yew. It's like react-toastify but for yew and more simpler (so far ๐Ÿ˜).

deploy

Documentation: https://yn-docs.qkation.com/yew_notifications/index.html

โฌ†๏ธ demo site

โฌ†๏ธ demo site

Where it already used?

Motivation

I was writing my personal project crypto-helper some time ago. I was forced to write awful code 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 already has implemented standard notifications but you can write your own. See basic and custom examples for more information.
# Cargo.toml

# if you want to use standard notification components
yew-notifications = { git = "https://github.com/TheBestTvarynka/yew-notifications.git", features = ["standard-notification"] }

# if you decide to write and use custom notification components
yew-notifications = { git = "https://github.com/TheBestTvarynka/yew-notifications.git" }
  1. Include yew-notification styles into your project:
<link data-trunk rel="sass" href="https://raw.githubusercontent.com/TheBestTvarynka/yew-notifications/main/static/notifications_provider.scss" />

This one below is needed only when you decide to use components from the yew-notifications:

<link data-trunk rel="sass" href="https://raw.githubusercontent.com/TheBestTvarynka/yew-notifications/main/static/notification.scss" />

Or you can copy scss file into your project and specify the path to it instead of the link. At this point, the scss file is one possible way to import styles.

  1. Wrap needed components into NotificationProvider:
// 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
<NotificationsProvider<Notification, NotificationFactory> {component_creator}>
    // some inner components
</NotificationsProvider<Notification, NotificationFactory>>
  1. Spawn notifications:
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::<Notification>();
notifications_manager.spawn(Notification::new(...));

See the 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 - [email protected].

Distributed under the MIT license.

Contributing

Feel free to contribute.

  1. Fork it (https://github.com/TheBestTvarynka/yew-notifications/fork)
  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

yew-notifications's People

Contributors

thebesttvarynka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

yew-notifications's Issues

Upload on crates.io ?

Hi there!

I came across this crate and I'm about to try it out! I was surprised its documentation is not on docs.rs, neither is the crate on crates.io, is there a reason why you have not uploaded it?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.