From d7bca93af85c882837cff840565ae9160e1aa79f Mon Sep 17 00:00:00 2001 From: httpjamesm Date: Sat, 4 Feb 2023 12:58:50 -0500 Subject: [PATCH] feat: sort select with button --- public/icons/sort.svg | 3 +++ public/question.css | 36 ++++++++++++++++++++++++++++++++++++ templates/question.html | 30 +++++++++++++++++++++++------- 3 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 public/icons/sort.svg diff --git a/public/icons/sort.svg b/public/icons/sort.svg new file mode 100644 index 0000000..774757a --- /dev/null +++ b/public/icons/sort.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/question.css b/public/question.css index 87f54ef..cf25d6c 100644 --- a/public/question.css +++ b/public/question.css @@ -111,6 +111,42 @@ img { margin-bottom: 1rem; } +.answers-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.answers-header .sorting form { + display: flex; + align-items: center; + gap: .5rem; +} + +.answers-header select { + border: 0; + border-radius: 5px; + padding: 0.5rem; + background-color: var(--meta-bg); + color: var(--text-color); + height: 2rem; +} + +.answers-header button { + width: 2rem; + border: 0; + height: 2rem; + border-radius: 5px; + background-color: var(--meta-bg); + color: var(--text-color); + font-size: 1.5rem; + cursor: pointer; + + display: flex; + justify-content: center; + align-items: center; +} + @media only screen and (max-width: 800px) { body { padding-left: 1rem; diff --git a/templates/question.html b/templates/question.html index 57cb8eb..06e39eb 100644 --- a/templates/question.html +++ b/templates/question.html @@ -38,13 +38,30 @@

{{ .question.Body }}
- {{ if .question.Comments }} - {{ template "comments.html" .question }} - {{end}} - + {{ if .question.Comments }} {{ template "comments.html" + .question }} {{end}}
-

Answers

+
+

Answers

+
+
+ + +
+
+
{{ range $answer := .answers }}
- {{ if $answer.Comments }} - {{ template "comments.html" $answer }} + {{ if $answer.Comments }} {{ template "comments.html" $answer }} {{end}}