-
Notifications
You must be signed in to change notification settings - Fork 5
Refactor: 공통 필터 컴포넌트, app 파일 Head와 tanstack-query 설정 #46
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
Merged
summerDev96
merged 4 commits into
codeit-part3-7:dev
from
summerDev96:refactor/filter-bug
Jul 23, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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,9 +1,10 @@ | ||
| import { Badge } from '@/components/ui/badge'; | ||
| import { DualSlider } from '@/components/ui/dual-slider'; | ||
| import { Label } from '@/components/ui/label'; | ||
| import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'; | ||
| import useFilterStore, { WineType } from '@/stores/filterStore'; | ||
|
|
||
| import DualSlider from '../slider/DualSlider'; | ||
|
|
||
| const Filter = () => { | ||
| const { type, setType, minPrice, maxPrice, setPriceRange, rating, setRating } = useFilterStore(); | ||
|
|
||
|
|
@@ -13,8 +14,8 @@ const Filter = () => { | |
| return ( | ||
| <div className='m-8 flex flex-col gap-9'> | ||
| <div className='flex flex-col gap-3'> | ||
| <span className='text-xl font-bold'>WINE TYPES</span> | ||
| <div className='flex gap-2.5'> | ||
| <span className='custom-text-xl-bold'>WINE TYPES</span> | ||
| <div className='flex gap-3'> | ||
| {/* todo: 공통 뱃지로 변경 필요 */} | ||
| {wineTypeOptions.map((option, index) => ( | ||
| <Badge | ||
|
|
@@ -28,29 +29,22 @@ const Filter = () => { | |
| ))} | ||
| </div> | ||
| </div> | ||
| <div className='flex flex-col gap-5'> | ||
| <span className='text-xl font-bold'>PRICE</span> | ||
| {/* todo: 공통 레인지 슬라이더로 변경 필요 */} | ||
| <DualSlider | ||
| min={0} | ||
| max={100000} | ||
| step={1000} | ||
| defaultValue={[0, 100000]} | ||
| value={priceRange} | ||
| onValueChange={setPriceRange} | ||
| minStepsBetweenThumbs={5} | ||
| /> | ||
| <div className='flex flex-col gap-2'> | ||
| <span className='custom-text-xl-bold'>PRICE</span> | ||
| <DualSlider max={1000000} value={priceRange} onChange={setPriceRange} /> | ||
|
Member
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. 잘 넘겨주신 것 같습니다! |
||
| </div> | ||
| <div className='flex flex-col gap-2.5'> | ||
| <span className='text-xl font-bold'>RATING</span> | ||
| <span className='custom-text-xl-bold'>RATING</span> | ||
| {/* todo: 공통 라디오, 라벨 컴포넌트로 변경 필요 */} | ||
| <RadioGroup value={rating} onValueChange={setRating}> | ||
| <div className='flex items-center gap-3'> | ||
| {/* 전체인 경우 rating값을 아예 안보내는 것 같아 임의로 all로 설정 */} | ||
| <RadioGroupItem value='all' id='rate-all' /> | ||
| <Label htmlFor='rate-all'>전체</Label> | ||
| <Label htmlFor='rate-all' className='custom-text-lg-medium'> | ||
| 전체 | ||
| </Label> | ||
| </div> | ||
| <div className='flex items-center gap-3'> | ||
| <div className='flex items-center gap-3 custom-text-lg-medium'> | ||
| <RadioGroupItem value='4.6' id='rate1' /> | ||
| <Label htmlFor='rate1'>4.5 - 5.0</Label> | ||
| </div> | ||
|
|
||
This file contains hidden or 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,27 +1,36 @@ | ||
| import '@/styles/globals.css'; | ||
|
|
||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
| import clsx from 'clsx'; | ||
| import Head from 'next/head'; | ||
| import { useRouter } from 'next/router'; | ||
|
|
||
| import Gnb from '@/components/common/Gnb'; | ||
|
|
||
| import type { AppProps } from 'next/app'; | ||
|
|
||
| const queryClient = new QueryClient(); | ||
|
|
||
| export default function App({ Component, pageProps }: AppProps) { | ||
| const { pathname } = useRouter(); | ||
| const pagesWithoutGnb = ['/login', '/signup', '/_error']; | ||
| const pagesWithoutGnb = ['/login', '/signup', '/signin', '/_error']; | ||
| const hideHeader = pagesWithoutGnb.includes(pathname); | ||
|
|
||
| return ( | ||
| <> | ||
| {!hideHeader && <Gnb />} | ||
| <div | ||
| className={clsx({ | ||
| 'pt-[70px] md:pt-[100px] xl:pt-[110px]': !hideHeader, | ||
| })} | ||
| > | ||
| <Component {...pageProps} /> | ||
| </div> | ||
| <Head> | ||
| <title>WINE</title> | ||
| </Head> | ||
| <QueryClientProvider client={queryClient}> | ||
| {!hideHeader && <Gnb />} | ||
|
Collaborator
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. 불필요한 렌더링까지 잘 줄이신 것 같습니다. 고생하셨습니다! |
||
| <div | ||
| className={clsx({ | ||
| 'pt-[70px] md:pt-[100px] xl:pt-[110px]': !hideHeader, | ||
| })} | ||
| > | ||
| <Component {...pageProps} /> | ||
| </div> | ||
| </QueryClientProvider> | ||
| </> | ||
| ); | ||
| } | ||
This file contains hidden or 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
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.
놓친 부분인데 찾아주셨네요! 주석 제거하겠습니다