From 12a980f327250c99d0e5c1a06c8a9f70b811962c Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Tue, 27 Jan 2026 00:48:17 -0500 Subject: [PATCH] feat: add headers to nav list --- src/components/lists/multi/select_nav_list.rs | 39 ++++++++++++++++--- src/pages/admin/provider_page.rs | 14 ++++++- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/components/lists/multi/select_nav_list.rs b/src/components/lists/multi/select_nav_list.rs index a6afdf9..9c320cd 100644 --- a/src/components/lists/multi/select_nav_list.rs +++ b/src/components/lists/multi/select_nav_list.rs @@ -5,7 +5,7 @@ use crate::components::utils; #[derive(Debug, Clone)] pub struct NavListInfo { - pub text: String, + pub text: Vec, pub id: String, pub slug: String, } @@ -14,11 +14,25 @@ pub struct NavListInfo { fn NavListItem( #[prop(into)] name: Signal, #[prop(into)] value: Signal, - #[prop(into)] text: Signal, + #[prop(into)] text: Signal>, #[prop(into)] slug: Signal, #[prop(into)] selected: Signal, #[prop(into)] on_change: Callback<()>, ) -> impl IntoView { + let linked_info = Signal::derive(move || + text.get() + .get(0) + .cloned() + .unwrap_or_default() + ); + let other_info = Signal::derive(move || + text.get() + .iter() + .cloned() + .skip(1) + .collect::>() + ); + view! { } } @@ -80,6 +101,7 @@ fn NavListCheckbox( pub fn SelectableNavList( #[prop(into)] selected: RwSignal>, #[prop(into)] items: Signal>, + #[prop(into)] headers: Signal>, #[prop(into)] name: Signal, ) -> impl IntoView { let all_selected = RwSignal::new(false); @@ -106,13 +128,20 @@ pub fn SelectableNavList( // Header block - contains evenly spaced headers and the "select all" checkbox. // Include a checkbox here that's got the same style as the items. This maintains spacing. // All headers *must* be evenly spaced, otherwise the list starts getting confusing. -
+
+ +
{header_text}
+
// Items block - contains constructed items. These are selectable. impl IntoView { let selected_items = RwSignal::new(Vec::new()); let provider_list = RwSignal::new(vec![ NavListInfo { - text: "Testing 1".to_string(), + text: vec!["Testing 1".to_string(), 3.to_string(), 500.to_string()], id: "1".to_string(), slug: "1".to_string(), }, NavListInfo { - text: "Testing 2".to_string(), + text: vec!["Testing 2".to_string(), 2.to_string(), 1000.to_string()], id: "2".to_string(), slug: "2".to_string(), } ]); + + let headers = vec![ + "Scholarship Name", + "Number of Awards", + "Amount of Awards" + ] + .iter() + .map(|s| s.to_string()) + .collect::>(); view! {
@@ -24,6 +33,7 @@ pub fn AdminProviderPage() -> impl IntoView { selected=selected_items name="providers-nav-list" items=provider_list + headers=headers />
}