about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-11-05 11:46:51 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-11-05 17:25:01 +0100
commit3f709164ddd0993d02eb56c43736672dca3d7541 (patch)
tree4cd437c45b2fc28520ad881d9bce194aa9d215fe
parentFrontend: Link the OSSE logo to / (diff)
downloadOSSE-3f709164ddd0993d02eb56c43736672dca3d7541.tar.gz
OSSE-3f709164ddd0993d02eb56c43736672dca3d7541.tar.bz2
OSSE-3f709164ddd0993d02eb56c43736672dca3d7541.zip
Frontend: Display number of results below search bar
-rw-r--r--frontend/src/app.rs25
1 files changed, 17 insertions, 8 deletions
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! {
+                        <p>{"No results!"}</p>
+                    };
+                }
+
+                html! {
+                    <>
+                        //Problem with margin: When no results or early return then mb not applied
+                        <div class="mb-5 text-muted" style="font-size:0.85em;">
+                            {format!("{} Results for \"{}\"", results.len(), self.search_query)}
+                        </div>
+
+                        {results
                         .iter()
                         .sorted()
                         .map(|r| {
@@ -197,11 +209,8 @@ impl Component for OSSE {
                                 </div>
                             }
                         })
-                        .collect::<Html>()
-                } else {
-                    html! {
-                        <p>{"No results!"}</p>
-                    }
+                        .collect::<Html>()}
+                    </>
                 }
             };
 
@@ -223,7 +232,7 @@ impl Component for OSSE {
                 <div class="container">
                     <div class="row">
                         <div class="col">
-                                <section class="my-5">
+                                <section class="mt-5">
                                     <a href="/" style="text-decoration: none; color: inherit;">
                                         <b class="display-4">{"OSSE"}</b>
                                     </a>