change children prop with regular prop

This commit is contained in:
davitbejanyan 2023-04-11 16:29:06 +04:00
parent 800daa9bc8
commit d9328a91f5
2 changed files with 10 additions and 8 deletions

View file

@ -16,7 +16,7 @@ export interface InputProps
withError?: boolean;
label?: React.ReactNode;
hint?: React.ReactNode;
children?: React.ReactNode;
icon?: React.ReactNode;
// Some may only accept integer, like `Number of Partitions`
// some may accept decimal
@ -112,7 +112,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => {
withError = false,
label,
hint,
children,
icon,
...rest
} = props;
@ -187,7 +187,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => {
ref={ref}
{...inputOptions}
/>
{search && children}
{search && icon}
{withError && isHookFormField && (
<S.FormError>

View file

@ -53,6 +53,7 @@ const Search: React.FC<SearchProps> = ({
ref.current.value = '';
}
};
return (
<Input
type="text"
@ -63,11 +64,12 @@ const Search: React.FC<SearchProps> = ({
disabled={disabled}
ref={ref}
search
>
<IconButtonWrapper onClick={clearSearchValue}>
<CloseIcon />
</IconButtonWrapper>
</Input>
icon={
<IconButtonWrapper onClick={clearSearchValue}>
<CloseIcon />
</IconButtonWrapper>
}
/>
);
};