autofocus search bar

This commit is contained in:
kageru 2024-01-04 14:17:20 +01:00
parent f70c1ecbfe
commit 26576d323f

@ -126,7 +126,7 @@ async fn search(q: Option<Either<web::Query<Query>, web::Form<Query>>>) -> AnyRe
let data = match q { let data = match q {
Some(q) => compute_results(q)?, Some(q) => compute_results(q)?,
None => TargetPage::Data(PageData { None => TargetPage::Data(PageData {
title: "YGO card search".to_owned(), title: NAME.to_owned(),
description: "Enter a query above to search".to_owned(), description: "Enter a query above to search".to_owned(),
query: None, query: None,
body: "<p>Welcome to my cheap Scryfall clone for Yugioh.</p>\ body: "<p>Welcome to my cheap Scryfall clone for Yugioh.</p>\
@ -189,7 +189,7 @@ fn add_searchbox(res: &mut String, query: &Option<String>) -> std::fmt::Result {
res, res,
r#" r#"
<form action="/"> <form action="/">
<input type="text" name="q" id="searchbox" placeholder="Enter query (e.g. l:5 c:synchro atk>2000)" value="{}"><input type="submit" id="submit" value="🔍"> <input type="text" name="q" autofocus id="searchbox" placeholder="Enter query (e.g. l:5 c:synchro atk>2000)" value="{}"><input type="submit" id="submit" value="🔍">
</form> </form>
"#, "#,
match &query { match &query {