impulse_thaw/toast/
toaster_provider.rs

1use super::{toaster::Toaster, ToastIntent, ToastPosition, ToasterInjection};
2use leptos::{context::Provider, prelude::*};
3
4#[component]
5pub fn ToasterProvider(
6    /// The position the toast should render.
7    #[prop(optional)]
8    position: ToastPosition,
9    /// The intent of the toasts
10    #[prop(optional)]
11    intent: ToastIntent,
12    children: Children,
13) -> impl IntoView {
14    let (injection, receiver) = ToasterInjection::channel();
15    view! {
16        <Toaster receiver position intent />
17        <Provider value=injection>{children()}</Provider>
18    }
19}