From d8d567cbce4452e02c26a4291bfc5707503d8c3c Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 9 Oct 2023 20:35:40 +0200 Subject: [PATCH] Try slot children --- src/app/components/timeline.rs | 40 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/app/components/timeline.rs b/src/app/components/timeline.rs index 48f4cc7..da5e516 100644 --- a/src/app/components/timeline.rs +++ b/src/app/components/timeline.rs @@ -15,22 +15,42 @@ pub fn Timeline( } } +#[slot] +pub struct TimelineCardContent { + children: ChildrenFn, +} + +#[slot] +pub struct TimelineCardSummary { + children: ChildrenFn, + tags: ChildrenFn, +} + #[component] -pub fn TimelineCard( - titles: F, - children: Children, -) -> impl IntoView - where - F: Fn() -> IV, - IV: IntoView, -{ +pub fn TimelineCard( + #[prop(default=vec![])] titles: Vec, + #[prop(default=vec![])] childrens: Vec, +) -> impl IntoView { view! {
- { titles() } + { + titles.iter().map(|v| view! { + <> + { (v.children)() } + { + view! { +
+ { (v.tags)() } +
+ } + } + + }).collect_view() + }
-
{ children() }
+
{ childrens.iter().map(|v| (v.children)()).collect_view() }
} } \ No newline at end of file