feat: sort select with button

This commit is contained in:
httpjamesm
2023-02-04 12:58:50 -05:00
parent bd48b309ac
commit d7bca93af8
3 changed files with 62 additions and 7 deletions

View File

@ -38,13 +38,30 @@
</p>
</div>
<div class="card-body">{{ .question.Body }}</div>
{{ if .question.Comments }}
{{ template "comments.html" .question }}
{{end}}
{{ if .question.Comments }} {{ template "comments.html"
.question }} {{end}}
</div>
<hr class="post-divider" />
<h2>Answers</h2>
<div class="answers-header">
<h2>Answers</h2>
<div class="sorting">
<form>
<select name="sort_by">
<option disabled value="votes">Sort answers by...</option>
<option value="votes">Votes</option>
<option value="newest">Trending</option>
<option value="newest">Newest</option>
<option value="oldest">Oldest</option>
</select>
<button type="submit">
<img
src="/static/icons/sort.svg"
alt="Sieve icon"
/>
</button>
</form>
</div>
</div>
{{ range $answer := .answers }}
<div class="answer">
<div
@ -65,8 +82,7 @@
>
</div>
</div>
{{ if $answer.Comments }}
{{ template "comments.html" $answer }}
{{ if $answer.Comments }} {{ template "comments.html" $answer }}
{{end}}
</div>
<hr class="answer-divider" />