-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 폴더명 변경 * refactor: RecipeSearchResultList -> RecipeSearchResultPreviewList로 이름 변경 * feat: 검색 꿀조합 목록 페이지 추가 * style: RecipeSearchResultPreviewList으로 컴포넌트 변경 * feat: 꿀조합 미리보기 개수를 4개로 수정 * refactor: DefaultRecipeItem 컴포넌트로 교체 * feat: 전체보기 버튼 스타일 수정 * fix: 꿀조합 페이지로 이동하지 않는 문제 해결 * feat: 불필요한 Link 제거 * feat: PageHeader 컴포넌트를 TopBar 컴포넌트로 교체 * refactor: 전체보기 버튼 컴포넌트 추가 * fix: 헤더 디자인 잘못된 부분 수정
- Loading branch information
Showing
18 changed files
with
150 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { moreIconWrapper, linkWrapper } from './showAllButton.css'; | ||
|
||
import { SvgIcon, Text } from '@/components/Common'; | ||
import { vars } from '@/styles/theme.css'; | ||
|
||
interface ShowAllButtonProps { | ||
link: string; | ||
} | ||
|
||
const ShowAllButton = ({ link }: ShowAllButtonProps) => { | ||
return ( | ||
<Link to={link} className={linkWrapper}> | ||
<div className={moreIconWrapper}> | ||
<SvgIcon variant="arrowRight" fill="none" stroke={vars.colors.gray5} /> | ||
</div> | ||
<Text as="span" color="info" weight="semiBold" size="caption2"> | ||
전체보기 | ||
</Text> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default ShowAllButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { vars } from '@/styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const linkWrapper = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 12, | ||
alignItems: 'center', | ||
width: 45, | ||
}); | ||
|
||
export const moreIconWrapper = style({ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: 40, | ||
height: 40, | ||
borderRadius: '50%', | ||
background: vars.colors.secondary1, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 43 additions & 0 deletions
43
src/components/Search/RecipeSearchResultPreviewList/RecipeSearchResultPreviewList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useRef } from 'react'; | ||
|
||
import { listWrapper } from './recipeSearchResultPreviewList.css'; | ||
import SearchNotFound from '../SearchNotFound/SearchNotFound'; | ||
|
||
import { ShowAllButton } from '@/components/Common'; | ||
import { DefaultRecipeItem } from '@/components/Recipe'; | ||
import { PATH } from '@/constants/path'; | ||
import { useIntersectionObserver } from '@/hooks/common'; | ||
import { useInfiniteRecipeSearchResultsQuery } from '@/hooks/queries/search'; | ||
import displaySlice from '@/utils/displaySlice'; | ||
|
||
interface RecipeSearchResultPreviewListProps { | ||
searchQuery: string; | ||
} | ||
|
||
const RecipeSearchResultPreviewList = ({ searchQuery }: RecipeSearchResultPreviewListProps) => { | ||
const { data: searchResponse, fetchNextPage, hasNextPage } = useInfiniteRecipeSearchResultsQuery(searchQuery); | ||
const scrollRef = useRef<HTMLDivElement>(null); | ||
useIntersectionObserver<HTMLDivElement>(fetchNextPage, scrollRef, hasNextPage); | ||
|
||
const recipes = searchResponse.pages.flatMap((page) => page.recipes); | ||
|
||
if (recipes.length === 0) { | ||
return <SearchNotFound />; | ||
} | ||
|
||
return ( | ||
<ul className={listWrapper}> | ||
{displaySlice(false, recipes, 4).map((recipe, idx) => ( | ||
<li key={recipe.id}> | ||
{idx < 4 ? ( | ||
<DefaultRecipeItem recipe={recipe} /> | ||
) : ( | ||
<ShowAllButton link={`${PATH.SEARCH}/recipes?query=${searchQuery}`} /> | ||
)} | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default RecipeSearchResultPreviewList; |
8 changes: 8 additions & 0 deletions
8
src/components/Search/RecipeSearchResultPreviewList/recipeSearchResultPreviewList.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const listWrapper = style({ | ||
display: 'flex', | ||
gap: 10, | ||
alignItems: 'center', | ||
overflowY: 'scroll', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export { default as ProductSearchResultPreviewList } from './ProductSearchResultList/ProductSearchResultPreviewList'; | ||
export { default as ProductSearchResultPreviewList } from './ProductSearchResultPreviewList/ProductSearchResultPreviewList'; | ||
export { default as RecommendList } from './RecommendList/RecommendList'; | ||
export { default as RecipeSearchResultList } from './RecipeSearchResultList/RecipeSearchResultList'; | ||
export { default as RecipeSearchResultPreviewList } from './RecipeSearchResultPreviewList/RecipeSearchResultPreviewList'; | ||
export { default as TagSearchResultList } from './TagSearchResultList/TagSearchResultList'; | ||
export { default as SearchInput } from './SearchInput/SearchInput'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const listWrapper = style({ | ||
display: 'grid', | ||
gridTemplateColumns: '1fr 1fr', | ||
gap: '16px 10px', | ||
padding: '0 20px', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters