From 3f709164ddd0993d02eb56c43736672dca3d7541 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 5 Nov 2022 11:46:51 +0100 Subject: Frontend: Display number of results below search bar --- frontend/src/app.rs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'frontend') diff --git a/frontend/src/app.rs b/frontend/src/app.rs index 60721d4..fb86e8a 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -186,8 +186,20 @@ impl Component for OSSE { let results = results.as_ref().unwrap(); - if !results.is_empty() { - results + if results.is_empty() { + return html! { +

{"No results!"}

+ }; + } + + html! { + <> + //Problem with margin: When no results or early return then mb not applied +
+ {format!("{} Results for \"{}\"", results.len(), self.search_query)} +
+ + {results .iter() .sorted() .map(|r| { @@ -197,11 +209,8 @@ impl Component for OSSE { } }) - .collect::() - } else { - html! { -

{"No results!"}

- } + .collect::()} + } }; @@ -223,7 +232,7 @@ impl Component for OSSE {
-
+
{"OSSE"} -- cgit 1.4.1