Ver Fonte

placeholder and fix bug

Ivan Galakhov há 4 anos atrás
pai
commit
580a69379a

+ 3 - 2
dashboard/src/components/SearchBar.tsx

@@ -5,9 +5,10 @@ import styled from "styled-components";
 interface Props {
   setSearchFilter: (x: string) => void;
   disabled: boolean;
+  prompt?: string;
 }
 
-const SearchBar: React.FC<Props> = ({ setSearchFilter, disabled }) => {
+const SearchBar: React.FC<Props> = ({ setSearchFilter, disabled, prompt }) => {
   const [searchInput, setSearchInput] = useState("");
 
   return (
@@ -24,7 +25,7 @@ const SearchBar: React.FC<Props> = ({ setSearchFilter, disabled }) => {
               setSearchFilter(searchInput);
             }
           }}
-          placeholder="Search repos..."
+          placeholder={prompt}
         />
       </SearchBarWrapper>
       <ButtonWrapper disabled={disabled}>

+ 2 - 1
dashboard/src/components/repo-selector/BranchList.tsx

@@ -46,7 +46,7 @@ const BranchList: React.FC<Props> = ({ setBranch, actionConfig }) => {
         setLoading(false);
         setError(true);
       });
-  });
+  }, []);
 
   const renderBranchList = () => {
     if (loading) {
@@ -90,6 +90,7 @@ const BranchList: React.FC<Props> = ({ setBranch, actionConfig }) => {
       <SearchBar
         setSearchFilter={setSearchFilter}
         disabled={error || loading}
+        prompt={"Search branches..."}
       />
       <BranchListWrapper>
         <ExpandedWrapper>{renderBranchList()}</ExpandedWrapper>

+ 1 - 0
dashboard/src/components/repo-selector/RepoList.tsx

@@ -168,6 +168,7 @@ const RepoList: React.FC<Props> = ({
           <SearchBar
             setSearchFilter={setSearchFilter}
             disabled={error || loading}
+            prompt={"Search repos..."}
           />
           <RepoListWrapper>
             <ExpandedWrapper>{renderRepoList()}</ExpandedWrapper>