mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 16:44:15 -05:00
15 lines
295 B
Rust
15 lines
295 B
Rust
|
use leptos::*;
|
||
|
|
||
|
#[component]
|
||
|
pub fn OptionComp<T, VF, IV>(cx: Scope, value: Option<T>, view: VF) -> impl IntoView
|
||
|
where
|
||
|
VF: Fn(Scope, T) -> IV + 'static,
|
||
|
IV: IntoView,
|
||
|
{
|
||
|
if let Some(value) = value {
|
||
|
view(cx, value).into_view(cx)
|
||
|
} else {
|
||
|
().into_view(cx)
|
||
|
}
|
||
|
}
|