From 587b5ff48c71f4533a3430e30534fe53adc89ecc Mon Sep 17 00:00:00 2001 From: meraghon Date: Sun, 23 Nov 2025 16:46:03 -0500 Subject: [PATCH] Functional dashboard button --- public/square-user.svg | 4 ++++ src/app.rs | 3 ++- src/components/dashboard_button.rs | 32 ++++++++++++++++++++++++++++-- src/components/mod.rs | 2 +- src/pages/mod.rs | 3 ++- src/pages/test_page.rs | 15 ++++++++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 public/square-user.svg create mode 100644 src/pages/test_page.rs diff --git a/public/square-user.svg b/public/square-user.svg new file mode 100644 index 0000000..92f1016 --- /dev/null +++ b/public/square-user.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/app.rs b/src/app.rs index e854ce4..1c7065b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,7 +7,7 @@ use leptos_router::{ }; use url::Url; -use crate::pages::{AboutPage, HomePage, UnauthenticatedPage}; +use crate::pages::{AboutPage, HomePage, TestPage, UnauthenticatedPage}; pub fn shell(options: LeptosOptions) -> impl IntoView { view! { @@ -67,6 +67,7 @@ pub fn App() -> impl IntoView { + diff --git a/src/components/dashboard_button.rs b/src/components/dashboard_button.rs index 47fe320..7bfec75 100644 --- a/src/components/dashboard_button.rs +++ b/src/components/dashboard_button.rs @@ -1,5 +1,33 @@ use leptos::prelude::*; +use leptos_router::hooks::use_navigate; #[component] -pub fn DashboardButton() -> impl IntoView { - view! {} +pub fn DashboardButton( + #[prop(into)] title: String, + #[prop(into, optional)] description: Option, + #[prop(into, optional)] icon: Option, + #[prop(into)] path: String, +) -> impl IntoView { + let navigate = use_navigate(); + + let on_click = move |_| navigate(&path, Default::default()); + + view! { + + } } diff --git a/src/components/mod.rs b/src/components/mod.rs index 283bd63..9c0e005 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -1,7 +1,7 @@ mod action_button; mod checkbox; mod chips; -mod dashboard_button; +pub(crate) mod dashboard_button; mod loading; mod multi_entry; mod panel; diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 5752a59..87d6b16 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -1,5 +1,6 @@ mod about_page; mod home_page; +mod test_page; mod unauthenticated_page; -pub use self::{about_page::*, home_page::*, unauthenticated_page::*}; +pub use self::{about_page::*, home_page::*, test_page::*, unauthenticated_page::*}; diff --git a/src/pages/test_page.rs b/src/pages/test_page.rs new file mode 100644 index 0000000..0541233 --- /dev/null +++ b/src/pages/test_page.rs @@ -0,0 +1,15 @@ +use crate::components::dashboard_button::DashboardButton; +use leptos::prelude::*; +#[component] +pub fn TestPage() -> impl IntoView { + view! { +
+ +
+ } +}