Skip to content

Commit

Permalink
Refactored search results code
Browse files Browse the repository at this point in the history
  • Loading branch information
balaraju-nerati committed Jun 26, 2024
1 parent 82b5d46 commit ce1d9ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/src/pages/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ export default function Search() {

const [isLoading, SetisLoading] = useState(false);
const [users, SetUsers] = useState([]);
// const[query,setQuery]=useState('');
const [resultsEmpty, setResultsEmpty] = useState(false);

const onChangeTextHandler = (e) => {
// setQuery(e.target.value);
if (!e.target.value) {
return;
}
Expand Down Expand Up @@ -106,9 +104,9 @@ export default function Search() {
searchHandler={searchHandler}
></SearchBar>
<div className=" w-[100%] flex box-border justify-center py-2 relative">
{!isLoading && resultsEmpty && <p>0 matching results found</p>}
{isLoading && <Loading></Loading>}
{!isLoading && users.length > 0 && (
{resultsEmpty && <p>0 matching results found</p>}
{users.length > 0 && (
<div className="w-[60%] border-[1px] rounded-md border-[#acacac] px-[1%] py-[1%] flex flex-col">
{users.map((data, index) => (
<User
Expand Down

0 comments on commit ce1d9ec

Please sign in to comment.