-
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,45 @@ | ||
| 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> | ||
| <meta charSet='UTF-8' /> | ||
|
||
| <meta name='viewport' content='width=device-width, initial-scale=1' /> | ||
| <meta name='description' content='와인 리뷰 사이트' /> | ||
| <meta property='og:title' content='WINE' /> | ||
| <meta property='og:description' content='와인 리뷰 사이트' /> | ||
| {/* todo: 배포 후 이미지, url 변경 필요 */} | ||
| <meta property='og:image' content='' /> | ||
| <meta property='og:url' content='' /> | ||
| <meta property='og:type' content='website' /> | ||
|
||
| </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> | ||
| </> | ||
| ); | ||
| } | ||
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.
놓친 부분인데 찾아주셨네요! 주석 제거하겠습니다