feat: add search functionality
This commit is contained in:
@ -14,7 +14,10 @@
|
||||
<h1>Welcome to dumb</h1>
|
||||
<p>An alternative frontend for genius.com</p>
|
||||
</div>
|
||||
<code>Just redirect Genius URLs to this instance and It's all good.</code>
|
||||
<form method="GET" action="/search">
|
||||
<input type="text" name="q" id="search-input" placeholder="Search..." />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{{template "footer"}}
|
||||
</div>
|
||||
|
36
views/search.tmpl
Normal file
36
views/search.tmpl
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Search - dumb</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/style.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body>
|
||||
<main id="app">
|
||||
{{template "navbar"}}
|
||||
<div id="search-page" class="main">
|
||||
<form method="GET">
|
||||
<input type="text" name="q" id="search-input" placeholder="Search..." value="{{.Query}}" />
|
||||
</form>
|
||||
<div id="search-results">
|
||||
{{range .Sections}}
|
||||
{{if eq .Type "song"}}
|
||||
<h1>Songs</h1>
|
||||
{{range .Hits}}
|
||||
<a id="search-item" href="{{.Result.Path}}">
|
||||
<img src="{{extractURL .Result.Thumbnail}}"/>
|
||||
<div>
|
||||
<span>{{.Result.ArtistNames}}</span>
|
||||
<h2>{{.Result.Title}}</h2>
|
||||
</div>
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "footer"}}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user