-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: category/reesult 페이지 분류 (#244)
- Loading branch information
Showing
15 changed files
with
310 additions
and
117 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,46 @@ | ||
import { Styled } from './styled' | ||
import type { PostSectionProps } from './types' | ||
import { useGetCategoriesQuery } from '@apis/post' | ||
import { SearchOptions, CategorySlideFilter, ProductList } from '@components' | ||
|
||
export const PostSection = ({ | ||
infinitePosts, | ||
postsCount = 0, | ||
searchOptions, | ||
onChangeSearchOption | ||
}: PostSectionProps) => { | ||
const getCategoriesQuery = useGetCategoriesQuery() | ||
const categories = | ||
getCategoriesQuery.data?.map(({ code, name }) => ({ | ||
code, | ||
name | ||
})) || [] | ||
|
||
return ( | ||
<> | ||
<Styled.CategorySliderWrapper> | ||
<CategorySlideFilter | ||
categories={categories} | ||
selectedCategory={searchOptions.category} | ||
onClickCategory={code => onChangeSearchOption('category', code)} | ||
/> | ||
</Styled.CategorySliderWrapper> | ||
<SearchOptions | ||
categories={categories} | ||
postsCount={postsCount} | ||
searchOptions={searchOptions} | ||
onChangeSearchOption={onChangeSearchOption} | ||
/> | ||
{postsCount > 0 ? ( | ||
<ProductList {...infinitePosts} /> | ||
) : ( | ||
<Styled.Placeholder> | ||
<Styled.PlaceholderTitle>검색 결과 없음</Styled.PlaceholderTitle> | ||
<Styled.PlaceholderDescription> | ||
찾으시는 검색 결과가 없어요 | ||
</Styled.PlaceholderDescription> | ||
</Styled.Placeholder> | ||
)} | ||
</> | ||
) | ||
} |
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,38 @@ | ||
import { css } from '@emotion/react' | ||
import styled from '@emotion/styled' | ||
|
||
const CategorySliderWrapper = styled.div` | ||
/* TODO: useMedia를 사용한 조건부 렌더링시 hydration 에러가 발생해 스타일로 우선 적용 했습니다. */ | ||
${({ theme }) => theme.mediaQuery.tablet} { | ||
display: none; | ||
} | ||
` | ||
|
||
const Placeholder = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
margin: 120px 0; | ||
text-align: center; | ||
` | ||
|
||
const PlaceholderTitle = styled.p` | ||
margin-bottom: 8px; | ||
${({ theme }) => theme.fonts.subtitle01B} | ||
` | ||
|
||
const PlaceholderDescription = styled.p` | ||
${({ theme }) => css` | ||
color: ${theme.colors.grayScale70}; | ||
${theme.fonts.body01M}; | ||
`} | ||
` | ||
|
||
export const Styled = { | ||
CategorySliderWrapper, | ||
Placeholder, | ||
PlaceholderTitle, | ||
PlaceholderDescription | ||
} |
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,12 @@ | ||
import type { | ||
SearchOptionsState, | ||
OnChangeSearchOptions | ||
} from '../../result/SearchOptions/types' | ||
import type { ProductListProps } from '@components/home' | ||
|
||
export type PostSectionProps = { | ||
postsCount?: number | ||
infinitePosts: ProductListProps | ||
searchOptions: SearchOptionsState | ||
onChangeSearchOption: OnChangeSearchOptions | ||
} |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export type ResultHeaderProps = { | ||
searchResult: string | ||
resultMessage: string | ||
postsCount: number | ||
} |
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.