-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/issue 65 feat 기술스택 팝오버 구현 #79
The head ref may contain hidden characters: "feature/issue-65--Feat-\uAE30\uC220\uC2A4\uD0DD-\uD31D\uC624\uBC84-\uAD6C\uD604"
Conversation
Stack_names는 stack 이름이 모두 저장된 배열, mock 데이터같이 쓸 수 있음
올바르지 않은 PR 형식올바르지 않은 PR 형식입니다. 참고PR요청 전 deveop 브랜치에 변동이 있을 경우 꼭! feature 브랜치를 rebase 해주세요. |
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.
label: string; | ||
onClick: (e: MouseEvent<HTMLDivElement>) => void; | ||
label: string; | ||
onDelete: (stack: string) => void; |
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.
onClick이 onDelete로 조금 더 명확한 이름으로 바뀌었습니다
외에는 안보셔도 됩니다
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.
전반적인 CSS 수정이 있었습니다.
안보셔도 괜찮습니다
return ( | ||
<Container $isSelected={isSelected} onClick={onClick}> | ||
{selectOption} | ||
{isSelected ? ( | ||
<Arrow src={popoverSelected.src} alt={popoverSelected.alt} /> | ||
<Arrow $isSelected src={popoverSelected.src} alt={popoverSelected.alt} /> |
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.
toggle Open 상태일 때 화살표 반대로 되도록 해놨습니다
외에는 안보셔도 됩니다
@@ -1,17 +1,26 @@ | |||
import styled from "styled-components"; |
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.
Styled 상속을 위해 코드가 좀 추가되었습니다
외에는 안보셔도 됩니다
//임시 | ||
const icon = stack && STACK_ICONS[stack] ? STACK_ICONS[stack] : ICONS.questionMark; | ||
const icon: Image = |
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.
Image는 새로 만든 타입인데, 저희 이미지들이 공통적으로 {src:string,alt:string} 구조로 되어있어서, 그걸 타입화 시켰습니다
|
||
interface StacksProps { | ||
stacks: string[]; | ||
} | ||
|
||
export default function Stacks({ stacks }: StacksProps) { | ||
return ( | ||
<Wrapper>{stacks.length > 0 ? stacks.map((stack) => <Stack key={stack} stack={stack} />) : <Stack />}</Wrapper> | ||
<Wrapper>{stacks.length > 0 ? stacks.map((stack) => <StackComponent key={stack} stack={STACKS[stack]} />) : <StackComponent />}</Wrapper> |
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.
STACK에 모든 stack 데이터를 넣어놨기 때문에, 이미지와 이름도 그쪽에서 가지고 옵니다
} | ||
|
||
export default function SelectLayout({ onStacksChange }: SelectLayoutProps) { | ||
const [filter, setFilter] = useState<StackPositionFilter>("ALL"); |
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.
초기값은 전체를 표시합니다
return ( | ||
<Container $isSelectedStacks={selectedStacks.length !== 0}> | ||
<FilterList | ||
currentFilter={getFilterKey(filter)} |
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.
Filter는 영어로 되어있어서 (백엔드에 한글로 저장할지 영어로 저장할지 고민중입니다, 그래서 우선 Mapping으로 처리되어있어요) 역추적으로 한글값을 가져와야합니다
constant에서 구체적으로 확인하실 수 있어요
<StackChipList | ||
selectedStacks={selectedStacks} | ||
filter={filter} | ||
onStackChipClick={(stack) => { |
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.
누른 stack이 selectedStacks 배열에 있으면 없애고, 없으면 추가하는 로직입니다
<DeleteStackChipList | ||
stacks={selectedStacks} | ||
onDeleteStack={(stack) => { | ||
setSelectedStacks((prevStacks) => prevStacks.filter((prevStack) => prevStack !== stack)); |
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.
selectedStacks에서 해당 stack을 삭제하는 로직입니다
grid-template-areas: | ||
"filterlist resetbutton" | ||
"stackchips stackchips" | ||
${({ $isSelectedStacks }) => $isSelectedStacks && `"deletestackchips deletestackchips"`}; |
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.
selectedStack이 있을때만, deleteStackChips를 Grid내에 배치하도록 했습니다
이렇게 하지 않으면 컴포넌트는 none이어도, Grid에 gap이 적용되어서 디자인이 안맞습니다
} | ||
`; | ||
|
||
const FilterList = styled(DefaultFilterList)` |
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.
grid-area넣으려고 styled 상속 했습니다
Default로 붙은 이유는, 원래 컴포넌트를 Default붙여서 새로 명명해서 가지고 오고, SelectLayout의 return문 내에는 원래 이름을 보여주고싶어서그렇슴당 (styled 붙으면서 바뀐 이름이 붙으면 코드가 너무 더러워서)
} | ||
|
||
export default function StackChipList({ selectedStacks, filter, onStackChipClick, className }: StackChipGridProps) { | ||
const filteredStacks = |
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.
filter값에 따라 filter됩니다
ALL은 다 노출돼요
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.
더 범용적으로 만들 수도 있을 것 같은데, 우선 딱히 쓰는 곳은 없어서 Stack 특성화로 만들어져있습니다
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.
실제 버튼 쓰실 땐 이거 가져다가 쓰시면 됩니다
File changed가 많아요🥹 이것저것 같이 수정되다보니 늘어났는데 아래만 봐주시면 됩니다
📌요구사항
📌작업 진행 상황 (에러, 막혔던 부분, 그외 궁금한것 등등)
기술스택 팝오버 구현
FilterButton
에SelectLayout
을 추가한 컴포넌트입니다SelectLayout
FilterList
,StackChipList
,ResetButton
,DeleteChipList
로 이루어져있어요onStacksChange
FilterList
filters
)과 현재 선택된 필터(currentFilter
)를 props로 받아, 사용자가 특정 필터를 클릭할 때onFilterClick
콜백 함수를 호출합니다특징
hover
되어있을 때, 현재 선택된 필터가 아니면 색상이 진하게 변합니다StackChipList
Props
DeleteStackChipList
Props
Reset
onReset
에 함수를 전달해서, 초기화시 하고싶은 행동을 전달하면, 버튼 클릭시 호출됩니다.📌스크린샷 / 테스트결과 (선택)
추가 참고사항
STACKS
STACK_NAMES
📌이슈 번호