Skip to content

Commit

Permalink
style: SearchResultList -> ProductSearchResultList
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejin-Yang committed Aug 15, 2023
1 parent 073bac2 commit 45983d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { PATH } from '@/constants/path';
import { useIntersectionObserver } from '@/hooks/common';
import { useInfiniteProductSearchResultsQuery } from '@/hooks/queries/search';

interface SearchResultListProps {
interface ProductSearchResultListProps {
searchQuery: string;
}

const SearchResultList = ({ searchQuery }: SearchResultListProps) => {
const ProductSearchResultList = ({ searchQuery }: ProductSearchResultListProps) => {
const { data: searchResponse, fetchNextPage, hasNextPage } = useInfiniteProductSearchResultsQuery(searchQuery);
const scrollRef = useRef<HTMLDivElement>(null);
useIntersectionObserver<HTMLDivElement>(fetchNextPage, scrollRef, hasNextPage);
Expand All @@ -29,23 +29,23 @@ const SearchResultList = ({ searchQuery }: SearchResultListProps) => {

return (
<>
<SearchResultListContainer>
<ProductSearchResultListContainer>
{products.map((product) => (
<li key={product.id}>
<Link as={RouterLink} to={`${PATH.PRODUCT_LIST}/${product.categoryType}/${product.id}`}>
<ProductItem product={product} />
</Link>
</li>
))}
</SearchResultListContainer>
</ProductSearchResultListContainer>
<div ref={scrollRef} aria-hidden />
</>
);
};

export default SearchResultList;
export default ProductSearchResultList;

const SearchResultListContainer = styled.ul`
const ProductSearchResultListContainer = styled.ul`
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Search/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { default as SearchResultList } from './SearchResultList/SearchResultList';
export { default as ProductSearchResultList } from './ProductSearchResultList/ProductSearchResultList';
export { default as RecommendList } from './RecommendList/RecommendList';
export { default as RecipeSearchResultList } from './RecipeSearchResultList/RecipeSearchResultList';
4 changes: 2 additions & 2 deletions frontend/src/pages/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Suspense, useState } from 'react';
import styled from 'styled-components';

import { ErrorBoundary, ErrorComponent, Input, Loading, SvgIcon, TabMenu } from '@/components/Common';
import { RecommendList, SearchResultList, RecipeSearchResultList } from '@/components/Search';
import { RecommendList, ProductSearchResultList, RecipeSearchResultList } from '@/components/Search';
import { SEARCH_PAGE_TABS } from '@/constants';
import { useDebounce } from '@/hooks/common';
import { useSearch } from '@/hooks/search';
Expand Down Expand Up @@ -67,7 +67,7 @@ const SearchPage = () => {
</Heading>
<Spacing size={20} />
{selectedTabMenu === SEARCH_PAGE_TABS[0] ? (
<SearchResultList searchQuery={debouncedSearchQuery} />
<ProductSearchResultList searchQuery={debouncedSearchQuery} />
) : (
<RecipeSearchResultList searchQuery={debouncedSearchQuery} />
)}
Expand Down

0 comments on commit 45983d2

Please sign in to comment.