Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/components/common/Filter/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import { Badge } from '@/components/ui/badge';
import { Label } from '@/components/ui/label';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
import { cn } from '@/lib/utils';
import useFilterStore, { WineType } from '@/stores/filterStore';

import DualSlider from '../slider/DualSlider';

const Filter = () => {
interface FilterProps {
showBorder: boolean;
}

const Filter = ({ showBorder = false }: FilterProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다. 목록 페이지에서는 showBorder 적용 안하는 스타일로 구현하겠습니다.

const { type, setType, minPrice, maxPrice, setPriceRange, rating, setRating } = useFilterStore();

const wineTypeOptions: WineType[] = ['Red', 'White', 'Sparkling'];
const priceRange: [number, number] = [minPrice, maxPrice];

const borderClass = 'border-b border-gray-100';

return (
<div className='m-8 flex flex-col gap-9'>
<div className='max-w-[20.5rem] m-8 flex flex-col'>
<div className='flex flex-col gap-3'>
<span className='custom-text-xl-bold'>WINE TYPES</span>
<div className='flex gap-3'>
{/* todo: 공통 뱃지로 변경 필요 */}
<div className='flex gap-4'>
{wineTypeOptions.map((option, index) => (
<Badge
key={`${option}-${index}`}
Expand All @@ -29,13 +35,19 @@ const Filter = () => {
))}
</div>
</div>
<div className='flex flex-col gap-2'>
<span className={cn(showBorder && borderClass, 'my-[1.9rem]')}></span>
<div className='flex flex-col'>
<span className='custom-text-xl-bold'>PRICE</span>
<DualSlider max={1000000} value={priceRange} onChange={setPriceRange} />
<DualSlider
max={1000000}
value={priceRange}
onChange={setPriceRange}
className='w-[17.7rem]'
/>
</div>
<span className={cn(showBorder && borderClass, 'my-[1.9rem]')}></span>
<div className='flex flex-col gap-2.5'>
<span className='custom-text-xl-bold'>RATING</span>
{/* todo: 공통 라디오, 라벨 컴포넌트로 변경 필요 */}
<RadioGroup value={rating} onValueChange={setRating}>
<div className='flex items-center gap-3'>
{/* 전체인 경우 rating값을 아예 안보내는 것 같아 임의로 all로 설정 */}
Expand Down