diff options
author | Alan Pearce | 2024-06-21 13:02:08 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-21 15:44:12 +0200 |
commit | a1dfc548198a1326e71f1dd70303a5d3441f7a39 (patch) | |
tree | 03e7d60dc389678ee7cadaac4d5e64596dffde91 /internal/components/search.templ | |
parent | cac323d9ae70f55a43fd99b73e60cf614be11797 (diff) | |
download | searchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.tar.lz searchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.tar.zst searchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.zip |
refactor: switch to templ for HTML templates
Diffstat (limited to 'internal/components/search.templ')
-rw-r--r-- | internal/components/search.templ | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/components/search.templ b/internal/components/search.templ new file mode 100644 index 0000000..2cae754 --- /dev/null +++ b/internal/components/search.templ @@ -0,0 +1,34 @@ +package components + +templ Search(tdata TemplateData, r ResultData) { + <form id="search" role="search"> + <fieldset> + <legend id="legend"> + <h2>{ sourceNameAndType(tdata.Source) } search</h2> + </legend> + <input + id="query" + aria-labelledby="legend" + name="query" + type="search" + value={ r.Query } + autofocus + spellcheck="false" + /> + <button>Search</button> + </fieldset> + </form> +} + +templ SearchPage(tdata TemplateData, r ResultData) { + @Page(tdata) { + @script(tdata.Assets.ByPath["/static/search.js"]) + @Search(tdata, r) + <section id="results" role="list" aria-label="search results"> + { children... } + </section> + <dialog id="dialog"> + <button autofocus>Close</button> + </dialog> + } +} |