yew_notifications/notification/
component_factory.rs

1use yew::{html, Callback, Html, MouseEvent};
2
3use crate::{NotifiableComponentFactory, Notification, NotificationComponent};
4
5/// Standard notification factory.
6///
7/// This factory used for [`Notification`] components creation.
8#[derive(Clone, PartialEq, Default)]
9pub struct NotificationFactory;
10
11impl NotifiableComponentFactory<Notification> for NotificationFactory {
12    fn component(
13        &self,
14        notification: Notification,
15        onclick: Callback<MouseEvent>,
16        onenter: Callback<MouseEvent>,
17        onleave: Callback<MouseEvent>,
18    ) -> Html {
19        html! {
20            <NotificationComponent {notification} {onclick} {onenter} {onleave} />
21        }
22    }
23}