From 50698f9a7d7b73f5f8fd54c8286ba8859a7f1670 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Tue, 19 May 2026 20:48:46 +0200 Subject: [PATCH] feat(ui): add search clear button Search now exposes a small icon-only clear button whenever a query is present. Clicking it clears the term in one step and returns focus to the input so users can immediately type a replacement. The button uses the existing topbar styling language and a compact circled-x icon alongside the keyboard hint. Test Plan: - git diff --check Refs: user redesign nitpick about one-click search clearing --- .../src/components/Icon.tsx | 6 ++++++ .../src/components/topbar/SearchField.tsx | 13 +++++++++++++ .../src/styles/launcher.css | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/crates/lanspread-tauri-deno-ts/src/components/Icon.tsx b/crates/lanspread-tauri-deno-ts/src/components/Icon.tsx index c2dede7..a8a6f7a 100644 --- a/crates/lanspread-tauri-deno-ts/src/components/Icon.tsx +++ b/crates/lanspread-tauri-deno-ts/src/components/Icon.tsx @@ -67,6 +67,12 @@ export const Icon = { ), + clearCircle: (p: Props) => ( + + + + + ), check: (p: Props) => ( diff --git a/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx b/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx index d93c05b..82336c0 100644 --- a/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx +++ b/crates/lanspread-tauri-deno-ts/src/components/topbar/SearchField.tsx @@ -49,6 +49,19 @@ export const SearchField = ({ value, onChange }: Props) => { }} spellCheck={false} /> + {value && ( + + )} / ); diff --git a/crates/lanspread-tauri-deno-ts/src/styles/launcher.css b/crates/lanspread-tauri-deno-ts/src/styles/launcher.css index 9424eed..1831b98 100644 --- a/crates/lanspread-tauri-deno-ts/src/styles/launcher.css +++ b/crates/lanspread-tauri-deno-ts/src/styles/launcher.css @@ -223,6 +223,22 @@ .search input::placeholder { color: var(--t-3); } +.search-clear { + display: inline-grid; + place-items: center; + width: 22px; + height: 22px; + padding: 0; + border: 0; + border-radius: 999px; + background: transparent; + color: var(--t-3); + cursor: pointer; +} +.search-clear:hover { + color: var(--t-1); + background: rgba(255, 255, 255, 0.08); +} .search-kbd { display: inline-grid; place-items: center;