Skip to content

Commit

Permalink
CB-5081 makes search icon always visible for local databases list (#2800
Browse files Browse the repository at this point in the history
)

* CB-5081 makes search icon always visible for local databases list

* CB-5081 renames search icon props

---------

Co-authored-by: Daria Marutkina <[email protected]>
  • Loading branch information
sergeyteleshev and dariamarutkina authored Jul 25, 2024
1 parent 5be8582 commit 701e681
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions webapp/packages/core-blocks/src/FormControls/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface BaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>, IC
placeholder?: string;
disabled?: boolean;
disabledActions?: boolean;
manualApply?: boolean;
permanentSearchIcon?: boolean;
smallSize?: boolean;
onChange?: (value: string) => void;
onSearch?: (value: string) => void;
Expand Down Expand Up @@ -52,7 +52,7 @@ export const Filter = observer<ControlledProps | ObjectsProps<any, any>>(functio
disabled,
disabledActions,
className,
manualApply,
permanentSearchIcon,
smallSize,
onSearch,
onChange,
Expand Down Expand Up @@ -124,7 +124,7 @@ export const Filter = observer<ControlledProps | ObjectsProps<any, any>>(functio
/>

<div className={s(styles, { actionButtons: true })}>
{edited && !manualApply ? (
{edited && !permanentSearchIcon ? (
<ActionIconButton name="cross" disabled={disabled || disabledActions} className={s(styles, { actionButton: true })} onClick={handleClear} />
) : (
<ActionIconButton
Expand Down
20 changes: 18 additions & 2 deletions webapp/packages/core-blocks/src/ItemList/ItemListSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,31 @@ interface IProps {
onChange?: (value: string) => void;
onSearch?: (value: string) => void;
className?: string;
permanentSearchIcon?: boolean;
}

export const ItemListSearch: React.FC<IProps> = function ItemListSearch({ value, placeholder, disabled, onChange, onSearch, className }) {
export const ItemListSearch: React.FC<IProps> = function ItemListSearch({
value,
placeholder,
permanentSearchIcon,
disabled,
onChange,
onSearch,
className,
}) {
const styles = useS(style);
const translate = useTranslate();

return (
<Container className={s(styles, { listSearch: true }, className)} keepSize>
<Filter value={value} disabled={disabled} placeholder={translate(placeholder || 'ui_search')} onSearch={onSearch} onChange={onChange} />
<Filter
value={value}
disabled={disabled}
placeholder={translate(placeholder || 'ui_search')}
permanentSearchIcon={permanentSearchIcon}
onSearch={onSearch}
onChange={onChange}
/>
</Container>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const DatabaseList = observer<Props>(function DatabaseList({ databases, h
value={hosts}
placeholder={translate('connections_administration_search_database_tip')}
disabled={disabled}
permanentSearchIcon
onChange={onChange}
onSearch={searchHandler}
/>
Expand Down

0 comments on commit 701e681

Please sign in to comment.