diff --git a/src/components/date.rs b/src/components/date.rs index 8166a5a..798e739 100644 --- a/src/components/date.rs +++ b/src/components/date.rs @@ -1,4 +1,5 @@ -use crate::common::DateInfo; +use crate::common::{DateInfo, DateRange}; +use leptos::either::Either; use leptos::prelude::*; /// # Date Component /// @@ -7,6 +8,18 @@ use leptos::prelude::*; /// ``` /// ``` + +fn render_dates(dates: DateRange) -> impl IntoView { + match dates { + DateRange::Single(date) => Either::Left(view! { +
{date}
+ }), + DateRange::Range(start_date, end_date) => Either::Right(view! { +{start_date} " - " {end_date}
+ }), + } +} + #[component] pub fn Date( /// Struct of title, date, and description @@ -31,11 +44,11 @@ pub fn Date({info.description}