static: initial UI for vulns in search

For golang/go#48223

Change-Id: Ief87455ee7305018ba20be838a245855a107e8e5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/348790
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/static/frontend/search/search.tmpl b/static/frontend/search/search.tmpl
index 59b2a72..b640197 100644
--- a/static/frontend/search/search.tmpl
+++ b/static/frontend/search/search.tmpl
@@ -95,6 +95,7 @@
 {{define "search_package_results"}}
   <div>
     {{$query := .Query}}
+    {{$vulnsActive := (.Experiments.IsActive "vulns")}}
     {{range $i, $v := .Results}}
       {{$moreLink := eq $i (subtract $.Pagination.DefaultLimit 1)}}
       <div class="SearchSnippet" {{if $moreLink}}id="more-results"{{end}}>
@@ -107,6 +108,9 @@
             </a>
           </h2>
           {{with $v.ChipText}}<span class="go-Chip go-Chip--inverted">{{.}}</span>{{end}}
+          {{if $vulnsActive}}
+            {{range $v.Vulns}}{{template "vuln" .}}{{end}}
+          {{end}}
         </div>
         {{with $v.Synopsis}}
           <p class="SearchSnippet-synopsis" data-test-id="snippet-synopsis">
diff --git a/static/frontend/unit/versions/versions.tmpl b/static/frontend/unit/versions/versions.tmpl
index 6b44a58..ae4ed89 100644
--- a/static/frontend/unit/versions/versions.tmpl
+++ b/static/frontend/unit/versions/versions.tmpl
@@ -130,15 +130,3 @@
     {{end}}
   </div>
 {{end}}
-
-{{define "vuln"}}
-  <span class="go-Chip go-Chip--vuln">
-    <details class="go-Tooltip js-tooltip" data-gtmc="tooltip">
-      <summary class="go-textSubtle">
-	{{.ID}}
-	<img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24">
-      </summary>
-      <p>{{.Details}}</p>
-    </details>
-  </span>
-{{end}}
\ No newline at end of file
diff --git a/static/shared/vuln/vuln.tmpl b/static/shared/vuln/vuln.tmpl
new file mode 100644
index 0000000..b4a3f32
--- /dev/null
+++ b/static/shared/vuln/vuln.tmpl
@@ -0,0 +1,17 @@
+<!--
+  Copyright 2021 The Go Authors. All rights reserved.
+  Use of this source code is governed by a BSD-style
+  license that can be found in the LICENSE file.
+-->
+
+{{define "vuln"}}
+  <span class="go-Chip go-Chip--vuln">
+    <details class="go-Tooltip js-tooltip" data-gtmc="tooltip">
+      <summary class="go-textSubtle">
+	{{.ID}}
+	<img class="go-Icon" src="/static/shared/icon/help_gm_grey_24dp.svg" alt="" height="24" width="24">
+      </summary>
+      <p>{{.Details}}</p>
+    </details>
+  </span>
+{{end}}
\ No newline at end of file