-
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
전체 모임 필터 작업 및 UI 수정 작업 (필터 모달 삭제) #997
Changes from all commits
8cf31f5
66ec434
b35c704
65b1ae5
1ecbb24
a46f145
159dd5a
dcf171e
5cab518
6fb0719
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 |
---|---|---|
|
@@ -93,4 +93,4 @@ | |
"workspaces": [ | ||
"packages/*" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ampli } from '@/ampli'; | ||
import { FilterType } from '@constants/option'; | ||
import { useQueryString } from '@hooks/queryString'; | ||
import { SelectV2 } from '@sopt-makers/ui'; | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
import { styled } from 'stitches.config'; | ||
|
||
interface DropDownFilterProps { | ||
filter: FilterType; | ||
} | ||
|
||
function DropDownFilter({ filter }: DropDownFilterProps) { | ||
const router = useRouter(); | ||
const selectedPartQuery = router.query.part as string; | ||
const defaultValue = selectedPartQuery ? { label: selectedPartQuery, value: selectedPartQuery } : undefined; | ||
|
||
const { subject, options } = filter; | ||
const { value: selectedValue, setValue, deleteKey } = useQueryString(subject); | ||
|
||
const setPartQuery = (value: string) => { | ||
ampli.clickFilterPart({ group_part: value }); | ||
|
||
if (selectedValue === value) return deleteKey(); | ||
return setValue(value); | ||
}; | ||
|
||
return ( | ||
<SDropDownContainer> | ||
<SelectV2.Root type="text" visibleOptions={6} defaultValue={defaultValue} onChange={setPartQuery}> | ||
<SelectV2.Trigger> | ||
<SelectV2.TriggerContent placeholder={'대상 파트'} /> | ||
</SelectV2.Trigger> | ||
<SelectV2.Menu> | ||
{options.map(option => ( | ||
<SelectV2.MenuItem key={option} option={{ label: option, value: option }} /> | ||
))} | ||
</SelectV2.Menu> | ||
</SelectV2.Root> | ||
</SDropDownContainer> | ||
); | ||
} | ||
|
||
export default DropDownFilter; | ||
|
||
const SDropDownContainer = styled('div', { | ||
ml: '$16', | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { ampli } from '@/ampli'; | ||
import { CATEGORY_FILTER, PART_FILTER, STATUS_FILTER } from '@constants/option'; | ||
import { useDisplay } from '@hooks/useDisplay'; | ||
import { Chip } from '@sopt-makers/ui'; | ||
import { styled } from 'stitches.config'; | ||
|
||
interface ChipItemProps { | ||
|
@@ -8,10 +10,17 @@ interface ChipItemProps { | |
isSelected: boolean; | ||
addValue: (val: string) => void; | ||
deleteValue: (val: string) => void; | ||
resetQuery: () => void; | ||
} | ||
|
||
function ChipItem({ label, value, isSelected, addValue, deleteValue }: ChipItemProps) { | ||
function ChipItem({ label, value, isSelected, addValue, deleteValue, resetQuery }: ChipItemProps) { | ||
const { isTablet } = useDisplay(); | ||
const toggle = () => { | ||
if (value === '전체') { | ||
resetQuery(); | ||
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. 전체 클릭시 모든 파라미터를 reset 시키는 방식으로 한다면 다른 필터링 조건들도 함께 날아갈텐데 의도하신 부분이 맞을까요 ? 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. 네 맞습니다 ! |
||
return; | ||
} | ||
|
||
switch (label) { | ||
case CATEGORY_FILTER.label: | ||
ampli.clickFilterCategory({ group_category: value }); | ||
|
@@ -28,9 +37,9 @@ function ChipItem({ label, value, isSelected, addValue, deleteValue }: ChipItemP | |
return addValue(value); | ||
}; | ||
return ( | ||
<SOption isSelected={isSelected} onClick={toggle}> | ||
<Chip size={isTablet ? 'sm' : 'md'} active={isSelected} onClick={toggle}> | ||
{value} | ||
</SOption> | ||
</Chip> | ||
); | ||
} | ||
|
||
|
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.
mds chip 이 따로 있는데, mds chip 과 해당 chip 의 디자인이 동일한 게 맞을까요?? 보통의 경우엔 기존의 것이 legacy 이고 mds 컴포넌트로 교체해서요~!!
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.
아 저 Chips라는 부분이 내부적으로 만든 chip 컴포넌트를 사용하고 있었는데, 해당 chip 컴포넌트를 mds로 변경했어요!
그래서 칩들을 렌더링하는 컴포넌트인 Chips는 거의 그대로 재활용하는 방식으로 구현 진행했습니다 :)