From 9dfb0acb540ad56642932e592870c2aeca1754b1 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 23 Apr 2020 00:09:42 +0200 Subject: html: Add search hints. --- assets/css/screen.css | 22 ++++++++++++++++++++++ mumi/web/view/html.scm | 20 ++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/assets/css/screen.css b/assets/css/screen.css index 6d91471..11e02e5 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -98,13 +98,35 @@ tr.important svg { #search input:focus { width: 400px; } + #search #search-hints { + width: 400px; + } } @media (min-width: 768px) { #search input:focus { width: 500px; } + #search.form-inline #search-hints { + width: 500px; + } +} + +#search #search-hints { + display: none; + position: absolute; + background: white; + top: 2.5rem; + border: 1px solid #ced4da; + border-top: none; + box-shadow: 3px 3px 10px #ddd; + padding: 1em; + z-index: 2; +} +#search.form-inline:focus-within #search-hints { + display: block; } +#search { z-index: 3; } footer { border-color: #1A1A1A1A; diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm index 7b04668..1549f58 100644 --- a/mumi/web/view/html.scm +++ b/mumi/web/view/html.scm @@ -126,8 +126,24 @@ (clip-rule "evenodd")) "") (path (@ (fill-rule "evenodd") (d "M6.5 12a5.5 5.5 0 100-11 5.5 5.5 0 000 11zM13 6.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z") - (clip-rule "evenodd")) ""))))))) - + (clip-rule "evenodd")) "")))) + (div + (@ (id "search-hints")) + (p "You can improve the search results by making use of the +simple query language. Here is a list of supported query terms:") + (table + (@ (class "table table-sm table-borderless")) + (tbody + ,@(map (match-lambda + ((term description) + `(tr (td (span (@ (class "filter")) ,term)) + (td ,description)))) + '(("is:open" "open issues") + ("is:done" "closed issues") + ("submitter:" "search issue submitter") + ("author:" "search by message author") + ("date:yesterday..now" "search by issue date") + ("mdate:3m..2d" "search by message date"))))))))) (define* (search-widget #:key (text "")) `(div -- cgit v1.2.3