Skip to content

Commit

Permalink
Merge pull request #25 from chimobi-justice/chore/search_lower
Browse files Browse the repository at this point in the history
make search to lowercase
  • Loading branch information
chimobi-justice authored Oct 4, 2024
2 parents ae68589 + 10b099f commit 1d06052
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/pages/Search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChangeEvent, FunctionComponent, useEffect, useState } from 'react'
import { Box, Container, Image, Input, InputGroup, InputLeftElement, Text } from '@chakra-ui/react'
import { Box, Container, Image, Input, InputGroup, InputLeftElement, Spinner, Text } from '@chakra-ui/react'
import { FiSearch } from 'react-icons/fi'
import { useDebounce } from 'use-debounce'
import { Helmet } from 'react-helmet-async'
Expand All @@ -9,7 +9,6 @@ import SearchUsers from '@pages/Search/users'
import SearchArticles from '@pages/Search/articles'
import SearchThreads from '@pages/Search/threads'
import SearchImg from '@assets/images/searching.png'
import { Loading } from '@components/index'

const Search: FunctionComponent = () => {
const [searchQuery, setSearchQuery] = useState<string>('')
Expand Down Expand Up @@ -45,7 +44,7 @@ const Search: FunctionComponent = () => {
} = useGetSearch(value, 'threads');

const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
const value = e?.target?.value;
const value = e?.target?.value?.toLocaleLowerCase();
setSearchQuery(value);
if (value?.length === 0) {
// Clear the search results if input is cleared
Expand Down Expand Up @@ -117,7 +116,11 @@ const Search: FunctionComponent = () => {
</Box>
)}

{isLoadingUser && isLoadingArticles && isLoadingThreads && <Loading />}
{isLoadingUser && isLoadingArticles && isLoadingThreads && (
<Box textAlign={"center"} py={"15px"}>
<Spinner size={"xl"} />
</Box>
)}

<SearchUsers
users={searchArr?.users}
Expand Down

0 comments on commit 1d06052

Please sign in to comment.