use leptos::*; #[component] pub fn Modal( #[prop(into)] title: String, children: Children, #[prop(into)] on_confirm: Callback<()>, #[prop(into)] on_cancel: Callback<()>, #[prop(into)] visible: Signal, #[prop(into, default = "Confirm".to_string())] confirm_text: String, #[prop(into, default = "Cancel".to_string())] cancel_text: String, #[prop(into, default = false)] is_danger: bool, ) -> impl IntoView { let title = store_value(title); // Eagerly render children to a Fragment, which is Clone let child_view = store_value(children()); let on_confirm = store_value(on_confirm); let on_cancel = store_value(on_cancel); let confirm_text = store_value(confirm_text); let cancel_text = store_value(cancel_text); view! {

{title.get_value()}

{child_view.with_value(|c| c.clone())}
} }