diff options
author | navanchauhan <navanchauhan@gmail.com> | 2022-10-17 22:36:59 -0600 |
---|---|---|
committer | navanchauhan <navanchauhan@gmail.com> | 2022-10-17 22:36:59 -0600 |
commit | edf53abbe793681715a86634574beeff99fa5883 (patch) | |
tree | a01095f0a920a34bd25448f44adca7ed845d851f | |
parent | 2e2943c27176d8ddbfbc551632e4f9d0e86cb41e (diff) |
created components
-rw-r--r-- | templates/components/header.html | 6 | ||||
-rw-r--r-- | templates/components/section.html | 45 | ||||
-rw-r--r-- | templates/document_details.html | 35 | ||||
-rw-r--r-- | templates/home.html | 16 | ||||
-rw-r--r-- | templates/search_results.html | 73 |
5 files changed, 87 insertions, 88 deletions
diff --git a/templates/components/header.html b/templates/components/header.html new file mode 100644 index 0000000..60d5657 --- /dev/null +++ b/templates/components/header.html @@ -0,0 +1,6 @@ +{{ define "header" }} +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> +<script src="https://kit.fontawesome.com/32c297b57b.js" crossorigin="anonymous"></script> +{{ end }}
\ No newline at end of file diff --git a/templates/components/section.html b/templates/components/section.html new file mode 100644 index 0000000..563a6a9 --- /dev/null +++ b/templates/components/section.html @@ -0,0 +1,45 @@ +{{define "hero-small"}} +<section class="hero is-small is-primary"> + <div class="hero-body"> + <h1 class="title"> + {{.GlobalVars.Name}} + </h1> + <p class="subtitle"> + Full-text search FDA 510(k) database + </p> + </div> +</section> +{{end}} + +{{define "hero-medium"}} +<section class="hero is-medium is-primary"> + <div class="hero-body"> + <h1 class="title"> + {{ .GlobalVars.Name }} + </h1> + <p class="subtitle"> + Full-text search FDA 510(k) database + </p> + </div> +</section> +{{end}} + +{{define "search-bar-small"}} +<div class="container"> + <div class="container"> + <form action="/search" method="GET"> + <div class="field has-addons"> + <div class="control is-expanded has-icons-left"> + <input class="input" type="text" name="query" placeholder="Query" spellcheck="false"> + <span class="icon is-left"> + <i class="fa-regular fa-magnifying-glass"></i> + </span> + </div> + <div class="control"> + <input class="button is-primary" type="submit" value="Search"> + </div> + </div> + </form> + </div> + </div> +{{end}}
\ No newline at end of file diff --git a/templates/document_details.html b/templates/document_details.html index a078e46..9e98879 100644 --- a/templates/document_details.html +++ b/templates/document_details.html @@ -1,24 +1,11 @@ <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + {{ template "header" . }} <title>{{.SearchResults.id}} - {{.GlobalVars.Name}}</title> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> - <script src="https://kit.fontawesome.com/32c297b57b.js" crossorigin="anonymous"></script> </head> <body> - - <section class="hero is-small is-primary"> - <div class="hero-body"> - <h1 class="title"> - DogeKnows - </h1> - <p class="subtitle"> - Full-text search FDA 510(k) database - </p> - </div> - </section> + {{template "hero-small" .}} <section class="section"> <nav class="breadcrumb" aria-label="breadcrumbs"> <ul> @@ -26,23 +13,7 @@ <li class="is-active"><a href="#" aria-current="page">{{.SearchResults.id}}</a></li> </ul> </nav> - <div class="container"> - <div class="container"> - <form action="/search" method="GET"> - <div class="field has-addons"> - <div class="control is-expanded has-icons-left"> - <input class="input" type="text" name="query" placeholder="Query" spellcheck="false"> - <span class="icon is-left"> - <i class="fa-regular fa-magnifying-glass"></i> - </span> - </div> - <div class="control"> - <input class="button is-primary" type="submit" value="Search"> - </div> - </div> - </form> - </div> - </div> + {{ template "search-bar-small" . }} </section> <section class="section"> diff --git a/templates/home.html b/templates/home.html index ab185d4..31de085 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,23 +1,11 @@ <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + {{ template "header" . }} <title>{{.GlobalVars.Name}}</title> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> - <script src="https://kit.fontawesome.com/32c297b57b.js" crossorigin="anonymous"></script> </head> <body> - <section class="hero is-medium is-primary"> - <div class="hero-body"> - <h1 class="title"> - {{ .GlobalVars.Name }} - </h1> - <p class="subtitle"> - Full-text search FDA 510(k) database - </p> - </div> - </section> + {{ template "hero-medium" . }} <section class="section"> <div class="container"> <form action="/search" method="GET"> diff --git a/templates/search_results.html b/templates/search_results.html index dba3362..28b7b24 100644 --- a/templates/search_results.html +++ b/templates/search_results.html @@ -1,23 +1,11 @@ <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + {{ template "header" . }} <title>{{.OriginalQuery.Query}} - {{.GlobalVars.Name}}</title> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> - <script src="https://kit.fontawesome.com/32c297b57b.js" crossorigin="anonymous"></script> </head> <body> - <section class="hero is-small is-primary"> - <div class="hero-body"> - <h1 class="title"> - {{.GlobalVars.Name}} - </h1> - <p class="subtitle"> - Full-text search FDA 510(k) database - </p> - </div> - </section> + {{ template "hero-medium" . }} <section class="section"> <nav class="breadcrumb" aria-label="breadcrumbs"> <ul> @@ -74,36 +62,37 @@ </div> {{ end }} </div> - <!-- - <div class="table-container"> - <table class="table"> - <tr> - <th>510(k) Number</th> - <th>Title</th> - <th>Applicant</th> - <th>Hit Details</th> - <th>Submission Date</th> - <th>Predicates</th> - </tr> - {{ range .SearchResults }} - <tr> - <td><a href="https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfPMN/pmn.cfm?ID={{.id}}">{{ .id }}</a></td> - <td>{{ .title }}</td> - <td>{{ .applicant }}</td> - <td>{{unescapeHTML ._formatted.full_text}}</td> - <td>{{ .submission_date }}</td> - <td>{{ range .predicates}} - <a href="https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfPMN/pmn.cfm?ID={{.}}">{{ . }}</a>, - {{ end }} - </td> - </tr> - {{ end }} - </table> -</div>--> </section> {{ if .MoreResults }} - <a href="/2.0/search?query={{.OriginalQuery.Query}}&offset={{.LastOffset}}"> <p>Previous Page</p></a> - <a href="/2.0/search?query={{.OriginalQuery.Query}}&offset={{.Offset}}"> <p>Next Page</p></a> + <section class="section"> + <div class="container"> + <div class="columns"> + <div class="column"> + <div class="field has-addons"> + + <button class="button is-primary is-light is-medium is-fullwidth" href="/search?query={{.OriginalQuery.Query}}&offset={{.LastOffset}}" title="Previous Page"> + + <span class="icon is-small"> + <i class="fa-solid fa-left-long"></i> + </span> + <span>Previous Page</span> + </button> + </div> + </div> + <div class="column"> + <div class="field has-addons"> + <a class="button is-primary is-light is-medium is-fullwidth" href="/search?query={{.OriginalQuery.Query}}&offset={{.Offset}}" title="Next Page"> + <span> + Next Page + </span> + <span class="icon is-small"> + <i class="fa-solid fa-right-long"></i> + </span> + </a></div> + </div> + </div></div> + </section> + {{ end }} </body> </html>
\ No newline at end of file |