From 857ee2f18bb42785b0473c4c94285a98c69d96e4 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Fri, 22 Nov 2024 18:11:12 -0500 Subject: [PATCH 1/2] Add a slot to show search tips --- src/langs/json/en.json | 5 +- src/lib/components/forms/Search.svelte | 82 ++++++++++++------- .../forms/stories/Search.stories.svelte | 15 +++- .../components/layouts/DocumentBrowser.svelte | 23 ++++-- 4 files changed, 85 insertions(+), 40 deletions(-) diff --git a/src/langs/json/en.json b/src/langs/json/en.json index 0ec1235fb..1f93efbcc 100644 --- a/src/langs/json/en.json +++ b/src/langs/json/en.json @@ -11,7 +11,10 @@ "title": "Title" }, "search": { - "matchingResults": "{n, plural, one {# matching result} other {# matching results}}" + "matchingResults": "{n, plural, one {# matching result} other {# matching results}}", + "reset": "Clear Search", + "help": "Use filters like user:, project: or organization: to refine searches. Use sort: to order results.", + "more": "Learn more" }, "homeTemplate": { "signedIn": "Signed in as {name}", diff --git a/src/lib/components/forms/Search.svelte b/src/lib/components/forms/Search.svelte index d38672ff9..d684b573f 100644 --- a/src/lib/components/forms/Search.svelte +++ b/src/lib/components/forms/Search.svelte @@ -11,6 +11,7 @@ export let query: string = ""; export let placeholder: string = $_("common.search"); export let action: Maybe = undefined; + export let id = "query"; let input: HTMLInputElement; let form: HTMLFormElement; @@ -48,50 +49,46 @@ on:reset={clear} bind:this={form} > -