Skip to content

Commit

Permalink
[PUI] Search tweak (inventree#8381)
Browse files Browse the repository at this point in the history
* Cleanup buttons and add Tooltip

* Clearer separation

* Link cleanup
  • Loading branch information
SchrodingersGat authored Oct 28, 2024
1 parent 234ee2b commit 89946ae
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/frontend/src/components/nav/SearchDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
Space,
Stack,
Text,
TextInput
TextInput,
Tooltip
} from '@mantine/core';
import { useDebouncedValue } from '@mantine/hooks';
import {
Expand Down Expand Up @@ -69,8 +70,8 @@ function QueryResultGroup({

return (
<Paper
withBorder
shadow="sm"
radius="xs"
p="md"
key={`paper-${query.model}`}
aria-label={`search-group-${query.model}`}
Expand Down Expand Up @@ -100,10 +101,11 @@ function QueryResultGroup({
<Stack aria-label={`search-group-results-${query.model}`}>
{query.results.results.map((result: any) => (
<Anchor
underline="never"
onClick={(event: any) =>
onResultClick(query.model, result.pk, event)
}
key={result.pk}
key={`result-${query.model}-${result.pk}`}
>
<RenderInstance instance={result} model={query.model} />
</Anchor>
Expand Down Expand Up @@ -376,7 +378,6 @@ export function SearchDrawer({
<TextInput
aria-label="global-search-input"
placeholder={t`Enter search text`}
radius="xs"
value={value}
onChange={(event) => setValue(event.currentTarget.value)}
leftSection={<IconSearch size="0.8rem" />}
Expand All @@ -387,19 +388,22 @@ export function SearchDrawer({
}
styles={{ root: { width: '100%' } }}
/>
<ActionIcon
size="lg"
variant="outline"
radius="xs"
onClick={() => searchQuery.refetch()}
>
<IconRefresh />
</ActionIcon>
<Tooltip label={t`Refresh search results`} position="bottom-end">
<ActionIcon
size="lg"
variant="transparent"
onClick={() => searchQuery.refetch()}
>
<IconRefresh />
</ActionIcon>
</Tooltip>
<Menu>
<Menu.Target>
<ActionIcon size="lg" variant="outline" radius="xs">
<IconSettings />
</ActionIcon>
<Tooltip label={t`Search Options`} position="bottom-end">
<ActionIcon size="lg" variant="transparent">
<IconSettings />
</ActionIcon>
</Tooltip>
</Menu.Target>
<Menu.Dropdown>
<Menu.Label>{t`Search Options`}</Menu.Label>
Expand All @@ -410,7 +414,6 @@ export function SearchDrawer({
onChange={(event) =>
setSearchRegex(event.currentTarget.checked)
}
radius="sm"
/>
</Menu.Item>
<Menu.Item>
Expand All @@ -420,7 +423,6 @@ export function SearchDrawer({
onChange={(event) =>
setSearchWhole(event.currentTarget.checked)
}
radius="sm"
/>
</Menu.Item>
</Menu.Dropdown>
Expand Down

0 comments on commit 89946ae

Please sign in to comment.