diff --git a/src/components/date.rs b/src/components/date.rs index 798e739..ec54de1 100644 --- a/src/components/date.rs +++ b/src/components/date.rs @@ -1,5 +1,5 @@ -use crate::common::{DateInfo, DateRange}; -use leptos::either::Either; +use crate::common::{DateInfo, DateRange, DateStatus}; +use leptos::either::{Either, EitherOf4}; use leptos::prelude::*; /// # Date Component /// @@ -20,6 +20,34 @@ fn render_dates(dates: DateRange) -> impl IntoView { } } +fn render_status(status: DateStatus) -> impl IntoView { + match status { + DateStatus::Upcoming => EitherOf4::A(view! { + + Upcoming + + }), + DateStatus::Open => EitherOf4::B(view! { + + Open + + }), + DateStatus::Deadline => EitherOf4::C(view! { + + Deadline + + }), + DateStatus::Closed => EitherOf4::D(view! { + + Closed + + }), + } +} #[component] pub fn Date( /// Struct of title, date, and description @@ -28,43 +56,37 @@ pub fn Date( /// The file path or URL of the icon displayed at the top of the button. #[prop(into)] icon: String, - /// The status of the event (open, upcoming, deadline...) - #[prop(into)] - status: String, ) -> impl IntoView { - important_dates.into_iter() - .map(|info: DateInfo| { - view! { -