-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 꿀조합 검색 디자인 변경점 적용 #91
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a518394
fix: 폴더명 변경
xodms0309 e00f4de
refactor: RecipeSearchResultList -> RecipeSearchResultPreviewList로 이름 변경
xodms0309 988beb5
feat: 검색 꿀조합 목록 페이지 추가
xodms0309 36536d4
style: RecipeSearchResultPreviewList으로 컴포넌트 변경
xodms0309 af2b182
feat: 꿀조합 미리보기 개수를 4개로 수정
xodms0309 c34816a
Merge remote-tracking branch 'origin/feat/v2' into feat/issue-80
xodms0309 74bd010
refactor: DefaultRecipeItem 컴포넌트로 교체
xodms0309 f5b1dfa
feat: 전체보기 버튼 스타일 수정
xodms0309 e8f4b21
fix: 꿀조합 페이지로 이동하지 않는 문제 해결
xodms0309 363caa8
feat: 불필요한 Link 제거
xodms0309 d5a74b4
feat: PageHeader 컴포넌트를 TopBar 컴포넌트로 교체
xodms0309 68d1089
refactor: 전체보기 버튼 컴포넌트 추가
xodms0309 dea19f7
fix: 헤더 디자인 잘못된 부분 수정
xodms0309 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
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,52 @@ | ||
import { useRef } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { linkWrapper, listWrapper, showMore } from './recipeSearchResultPreviewList.css'; | ||
import SearchNotFound from '../SearchNotFound/SearchNotFound'; | ||
|
||
import { SvgIcon, Text } 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 { vars } from '@/styles/theme.css'; | ||
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} /> | ||
) : ( | ||
<Link to={`${PATH.SEARCH}/recipes?query=${searchQuery}`} className={linkWrapper}> | ||
<div className={showMore}> | ||
<SvgIcon variant="arrowRight" stroke={vars.colors.gray5} /> | ||
</div> | ||
<Text size="caption2" weight="semiBold" color="info"> | ||
전체보기 | ||
</Text> | ||
</Link> | ||
)} | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default RecipeSearchResultPreviewList; |
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
import { vars } from '@/styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const listWrapper = style({ | ||
display: 'flex', | ||
gap: 10, | ||
alignItems: 'center', | ||
overflowY: 'scroll', | ||
}); | ||
|
||
export const showMore = style({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: 40, | ||
height: 40, | ||
background: vars.colors.secondary1, | ||
borderRadius: '50%', | ||
}); | ||
|
||
export const linkWrapper = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 12, | ||
alignItems: 'center', | ||
width: 45, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { useRef } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { styled } from 'styled-components'; | ||
import { useSearchParams } from 'react-router-dom'; | ||
|
||
import SearchNotFound from '../SearchNotFound/SearchNotFound'; | ||
import { listWrapper } from './recipeSearchListPage.css'; | ||
|
||
import { RecipeItem } from '@/components/Recipe'; | ||
import { PATH } from '@/constants/path'; | ||
import { PageHeader } from '@/components/Common'; | ||
import { DefaultRecipeItem } from '@/components/Recipe'; | ||
import SearchNotFound from '@/components/Search/SearchNotFound/SearchNotFound'; | ||
import { useIntersectionObserver } from '@/hooks/common'; | ||
import { useInfiniteRecipeSearchResultsQuery } from '@/hooks/queries/search'; | ||
|
||
interface RecipeSearchResultListProps { | ||
searchQuery: string; | ||
} | ||
export const RecipeSearchListPage = () => { | ||
const [searchParams, setSearchParams] = useSearchParams(); | ||
const searchQuery = searchParams.get('query') || ''; | ||
|
||
const RecipeSearchResultList = ({ searchQuery }: RecipeSearchResultListProps) => { | ||
const { data: searchResponse, fetchNextPage, hasNextPage } = useInfiniteRecipeSearchResultsQuery(searchQuery); | ||
const scrollRef = useRef<HTMLDivElement>(null); | ||
useIntersectionObserver<HTMLDivElement>(fetchNextPage, scrollRef, hasNextPage); | ||
|
@@ -26,24 +25,15 @@ const RecipeSearchResultList = ({ searchQuery }: RecipeSearchResultListProps) => | |
|
||
return ( | ||
<> | ||
<RecipeSearchResultListContainer> | ||
<PageHeader title={`'${searchQuery}'이/가 포함된 꿀조합`} hasBackLink /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 TopBar랑 디자인 다른가용?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오오 교체 가능 |
||
<ul className={listWrapper}> | ||
{recipes.map((recipe) => ( | ||
<li key={recipe.id}> | ||
<Link to={`${PATH.RECIPE}/${recipe.id}`}> | ||
<RecipeItem recipe={recipe} /> | ||
</Link> | ||
<DefaultRecipeItem recipe={recipe} /> | ||
</li> | ||
))} | ||
</RecipeSearchResultListContainer> | ||
</ul> | ||
<div ref={scrollRef} aria-hidden /> | ||
</> | ||
); | ||
}; | ||
|
||
export default RecipeSearchResultList; | ||
|
||
const RecipeSearchResultListContainer = styled.ul` | ||
& > li + li { | ||
margin-top: 40px; | ||
} | ||
`; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저 이거 만든거 있는데 합쳐주기 가능합니까.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옹 이거 뭐죠?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체보기! 상품 상세 꿀조합 리스트에도 있슴다