blob: f0fd68ab3c55a569212a9ea0c0be9fd0cbf3b18b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use leptos::ev::MouseEvent;
use leptos::prelude::*;
#[component]
pub fn Modal(
on_background_click: impl Fn(MouseEvent) + 'static,
children: Children,
) -> impl IntoView {
view! {
<div
class="modal"
on:click=move |e| {
if e.current_target() == e.target() {
on_background_click(e)
}
}
>
{children()}
</div>
}
}
|