diff --git a/src/components.rs b/src/components.rs index 5f7fff7..6f919fa 100644 --- a/src/components.rs +++ b/src/components.rs @@ -3,3 +3,4 @@ pub mod dashboard; pub mod search; pub mod personal; pub mod dashboard_tile; +pub mod dashboard_row; diff --git a/src/components/dashboard_row.rs b/src/components/dashboard_row.rs new file mode 100644 index 0000000..2917b86 --- /dev/null +++ b/src/components/dashboard_row.rs @@ -0,0 +1,39 @@ +use leptos::leptos_dom::*; +use leptos::*; +use serde::{Deserialize, Serialize}; +use crate::components::dashboard_tile::DashboardTile; + +/// A row of dashboard tiles, with a title +#[derive(Serialize, Deserialize)] +pub struct DashboardRow { + pub title: String, + pub tiles: Vec, +} + +impl DashboardRow { + pub fn new(title: String, tiles: Vec) -> Self { + Self { + title, + tiles, + } + } +} + +impl IntoView for DashboardRow { + fn into_view(self) -> View { + view! { +
+

{self.title}

+
    + {self.tiles.into_iter().map(|tile_info| { + view! { +
  • + { tile_info } +
  • + } + }).collect::>()} +
+
+ }.into_view() + } +}