Wizard: Use SearchInput component for packages
As a small simplification and also to make the UX more consistent, let's use a SearchInput widget over the custom InputGroup structure. The only aspect lost in the process is the `validation` property that doesn't exist in the SearchInput widget. It however only affects the CSS styling of the searchbox and renders the 'error' state when there's only a single character in the box. This may not even be desirable, given that it's not really an error and that we show a note right below the input box about this anyway. This means the search boxes will also be consistent between the repository and package search pages. Fixes #3133
This commit is contained in:
parent
0238c04dfe
commit
c7dd274298
1 changed files with 11 additions and 38 deletions
|
|
@ -15,19 +15,16 @@ import {
|
||||||
EmptyStateIcon,
|
EmptyStateIcon,
|
||||||
EmptyStateVariant,
|
EmptyStateVariant,
|
||||||
Icon,
|
Icon,
|
||||||
InputGroup,
|
|
||||||
InputGroupItem,
|
|
||||||
InputGroupText,
|
|
||||||
Pagination,
|
Pagination,
|
||||||
PaginationVariant,
|
PaginationVariant,
|
||||||
Popover,
|
Popover,
|
||||||
|
SearchInput,
|
||||||
Spinner,
|
Spinner,
|
||||||
Stack,
|
Stack,
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
TabTitleText,
|
TabTitleText,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
|
||||||
ToggleGroup,
|
ToggleGroup,
|
||||||
ToggleGroupItem,
|
ToggleGroupItem,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
|
|
@ -40,7 +37,6 @@ import {
|
||||||
HelpIcon,
|
HelpIcon,
|
||||||
OptimizeIcon,
|
OptimizeIcon,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
TimesIcon,
|
|
||||||
} from '@patternfly/react-icons';
|
} from '@patternfly/react-icons';
|
||||||
import {
|
import {
|
||||||
ExpandableRowContent,
|
ExpandableRowContent,
|
||||||
|
|
@ -1248,39 +1244,16 @@ const Packages = () => {
|
||||||
<Stack>
|
<Stack>
|
||||||
<ToolbarContent>
|
<ToolbarContent>
|
||||||
<ToolbarItem variant="search-filter">
|
<ToolbarItem variant="search-filter">
|
||||||
<InputGroup>
|
<SearchInput
|
||||||
<InputGroupItem isFill>
|
data-ouia-component-id="packages-search-input"
|
||||||
<InputGroupText id="search-icon">
|
type="text"
|
||||||
<SearchIcon />
|
placeholder="Type to search"
|
||||||
</InputGroupText>
|
aria-label="Search packages"
|
||||||
<TextInput
|
data-testid="packages-search-input"
|
||||||
data-ouia-component-id="packages-search-input"
|
value={searchTerm}
|
||||||
type="text"
|
onChange={handleSearch}
|
||||||
validated={
|
onClear={() => handleClear()}
|
||||||
debouncedSearchTermLengthOf1 &&
|
/>
|
||||||
!debouncedSearchTermIsGroup
|
|
||||||
? 'error'
|
|
||||||
: 'default'
|
|
||||||
}
|
|
||||||
placeholder="Type to search"
|
|
||||||
aria-label="Search packages"
|
|
||||||
data-testid="packages-search-input"
|
|
||||||
value={searchTerm}
|
|
||||||
onChange={handleSearch}
|
|
||||||
/>
|
|
||||||
</InputGroupItem>
|
|
||||||
{searchTerm && (
|
|
||||||
<InputGroupItem>
|
|
||||||
<Button
|
|
||||||
variant="control"
|
|
||||||
aria-label="clear-package-search"
|
|
||||||
onClick={handleClear}
|
|
||||||
icon={<TimesIcon />}
|
|
||||||
ouiaId="clear-package-search-button"
|
|
||||||
/>
|
|
||||||
</InputGroupItem>
|
|
||||||
)}
|
|
||||||
</InputGroup>
|
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<ToggleGroup>
|
<ToggleGroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue