Skip to content

Commit b1fd735

Browse files
committed
feat(web): improve search input discoverability and responsiveness
- Add chevron dropdown icon with tooltip to indicate autocomplete capability - Reorganize rightSection to show clear, dropdown, and loading states - Change fixed width to responsive maxWidth with 100% base width - Improves mobile experience and suggests interactive features
1 parent b260806 commit b1fd735

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

apps/web/src/components/layout/HeaderSearchInput.tsx

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Stack,
1212
Text,
1313
TextInput,
14+
Tooltip,
1415
} from "@mantine/core";
1516
import { modals } from "@mantine/modals";
1617
import { notifications } from "@mantine/notifications";
@@ -19,6 +20,7 @@ import {
1920
IconBook,
2021
IconBuilding,
2122
IconBulb,
23+
IconChevronDown,
2224
IconClock,
2325
IconHistory,
2426
IconSearch,
@@ -426,8 +428,9 @@ export const HeaderSearchInput = () => {
426428
size="sm"
427429
styles={{
428430
root: {
429-
width: focused ? "420px" : "350px",
430-
transition: "width 200ms ease",
431+
width: "100%",
432+
maxWidth: focused ? "420px" : "350px",
433+
transition: "max-width 200ms ease",
431434
},
432435
input: {
433436
borderRadius: "8px",
@@ -440,23 +443,37 @@ export const HeaderSearchInput = () => {
440443
aria-autocomplete="list"
441444
role="combobox"
442445
rightSection={
443-
isLoadingSuggestions ? (
444-
<Loader size={ICON_SIZE.XS} />
445-
) : query ? (
446-
<ActionIcon
447-
size="sm"
448-
variant="transparent"
449-
onClick={() => {
450-
setQuery("");
451-
setSuggestions([]);
452-
setHighlightedIndex(-1);
453-
inputRef.current?.focus();
454-
}}
455-
aria-label="Clear search"
456-
>
457-
<IconX size={ICON_SIZE.SM} />
458-
</ActionIcon>
459-
) : null
446+
<Group gap={2}>
447+
{query && (
448+
<ActionIcon
449+
size="sm"
450+
variant="transparent"
451+
onClick={() => {
452+
setQuery("");
453+
setSuggestions([]);
454+
setHighlightedIndex(-1);
455+
inputRef.current?.focus();
456+
}}
457+
aria-label="Clear search"
458+
>
459+
<IconX size={ICON_SIZE.SM} />
460+
</ActionIcon>
461+
)}
462+
<Tooltip label="Search suggestions enabled" position="left" offset={-5} withinPortal>
463+
<ActionIcon
464+
size="sm"
465+
variant="transparent"
466+
color="gray"
467+
onClick={() => inputRef.current?.focus()}
468+
aria-label="Search with autocomplete"
469+
>
470+
<IconChevronDown size={ICON_SIZE.XS} />
471+
</ActionIcon>
472+
</Tooltip>
473+
{isLoadingSuggestions && (
474+
<Loader size={ICON_SIZE.XS} />
475+
)}
476+
</Group>
460477
}
461478
/>
462479
</Popover.Target>

0 commit comments

Comments
 (0)