Skip to content

Commit 47799e4

Browse files
committed
feat(home_page): enhance search link with SPA navigation callback
1 parent 83e3ca6 commit 47799e4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

frontend/src/pages/home.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ pub fn home_page() -> Html {
7474
];
7575

7676
let staticflow_search_href = crate::config::route_path("/search?q=staticflow");
77+
let on_staticflow_search_click = {
78+
let staticflow_search_href = staticflow_search_href.clone();
79+
Callback::from(move |event: MouseEvent| {
80+
event.prevent_default();
81+
let _ = crate::navigation_context::navigate_spa_to(&staticflow_search_href);
82+
})
83+
};
7784

7885
let social_button_class = classes!(
7986
"btn-fluent-icon",
@@ -347,7 +354,8 @@ pub fn home_page() -> Html {
347354
{ "Admin Console" }
348355
</Link<Route>>
349356
<a
350-
href={staticflow_search_href}
357+
href={staticflow_search_href.clone()}
358+
onclick={on_staticflow_search_click}
351359
class={classes!(
352360
"btn-fluent-search-hero",
353361
"no-underline"

0 commit comments

Comments
 (0)