Browse Source

change children prop with regular prop

davitbejanyan 2 years ago
parent
commit
d9328a91f5

+ 3 - 3
kafka-ui-react-app/src/components/common/Input/Input.tsx

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

+ 7 - 5
kafka-ui-react-app/src/components/common/Search/Search.tsx

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