From e3ea13d07d7a186dba88e50b6226856b77ed168b Mon Sep 17 00:00:00 2001 From: meraghon Date: Fri, 12 Dec 2025 12:13:41 -0500 Subject: [PATCH] Implement date element with struct --- src/components/date.rs | 74 ++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/src/components/date.rs b/src/components/date.rs index 9e57fff..8166a5a 100644 --- a/src/components/date.rs +++ b/src/components/date.rs @@ -1,5 +1,5 @@ +use crate::common::DateInfo; use leptos::prelude::*; - /// # Date Component /// /// @@ -9,15 +9,9 @@ use leptos::prelude::*; /// ``` #[component] pub fn Date( - /// The main label displayed on the button. + /// Struct of title, date, and description #[prop(into)] - title: String, - /// The calendar date of the event - #[prop(into)] - date: String, - /// A brief explanatory text that describes the destination page. - #[prop(into)] - description: String, + important_dates: Vec, /// The file path or URL of the icon displayed at the top of the button. #[prop(into)] icon: String, @@ -25,35 +19,39 @@ pub fn Date( #[prop(into)] status: String, ) -> impl IntoView { - view! { -
-
- icon -
-
-
-
-

- {title.clone()} -

-

- {date.clone()} -

-

- {description.clone()} -

-
-
- - {status.clone()} - + important_dates.into_iter() + .map(|info: DateInfo| { + view! { +
+
+ icon +
+
+
+
+

+ {info.title} +

+

+ {info.date} +

+

+ {info.description} +

+
+
+ + {status.clone()} + +
-
-
- } +
+ } + }) + .collect_view() }