Skip to content
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

Closed

Conversation

nakyoung98
Copy link
Contributor

File changed가 많아요🥹 이것저것 같이 수정되다보니 늘어났는데 아래만 봐주시면 됩니다

  • DeleteStackChipList
  • index
  • ResetButton
  • SelectLayout
  • StackChipList
  • Stack

📌요구사항

  • 기술스택 팝오버 구현
  • 기술 스택 우선 분류해서 대충 구성해놓기 (추후 보강)

image

📌작업 진행 상황 (에러, 막혔던 부분, 그외 궁금한것 등등)

기술스택 팝오버 구현

  • FilterButtonSelectLayout을 추가한 컴포넌트입니다

SelectLayout

image

  • FilterList, StackChipList, ResetButton, DeleteChipList 로 이루어져있어요

onStacksChange

  onStacksChange: (selectedStacks: string[]) => void;
  • 선택된 Stack들을 외부에서 callback으로 관리할 수 있습니다

FilterList

FilterList

  • 여러 곳에서 쓸 수 있게 범용성을 넓힌 리스트입니다
  • 여러 필터 옵션 중에서 선택할 수 있습니다
  • 필터 목록(filters)과 현재 선택된 필터(currentFilter)를 props로 받아, 사용자가 특정 필터를 클릭할 때 onFilterClick 콜백 함수를 호출합니다

특징

  • 현재 선택된 필터검정색, 아니면 회색으로 표시됩니다
  • 마우스가 hover되어있을 때, 현재 선택된 필터가 아니면 색상이 진하게 변합니다

StackChipList

StackChipList

  • StackChip을 일렬로 나열하는 컴포넌트입니다
  • 반응형 적용 되어있습니다

Props

interface StackChipGridProps {
  selectedStacks: string[];
  filter: StackPositionFilter;
  onStackChipClick: (stack: string) => void;
  className?: string;
}
  • selectedStacks: 선택된 stack들 정보를 넣으면 선택 css가 반응합니다
  • filter: 내용을 어떻게 분류처리할 지 입니다, 지정된 relatedPosition에 반응합니다
  • onStackChipClick: Chip선택하면 하고싶은 행동을 넣으시면 됩니다

DeleteStackChipList

DeleteChipLsit

  • DeleteStackChip이 표시되는 리스트입니다

Props

interface DeleteStackChipListProps {
  stacks: string[];
  onDeleteStack: (stack: string) => void;
  className?: string;
}
  • stacks: 존재하는 stack들을 넣으면 됩니다
  • onDeleteStack: chip의 삭제버튼을 누르면 호출되는 callback 함수입니다

Reset

Reset

  • Reset하는 컴포넌트입니다
  • onReset에 함수를 전달해서, 초기화시 하고싶은 행동을 전달하면, 버튼 클릭시 호출됩니다.



📌스크린샷 / 테스트결과 (선택)

popover



추가 참고사항

STACKS

image

  • Stack들을 담아놨습니다
  • 여기서 가져다 쓰시면 됩니다

STACK_NAMES

  • 이걸 통해서 이름만 가져오는 것도 가능합니다

📌이슈 번호

Stack_names는 stack 이름이 모두 저장된 배열, mock 데이터같이 쓸 수 있음
Copy link

올바르지 않은 PR 형식

올바르지 않은 PR 형식입니다.

참고

PR요청 전 deveop 브랜치에 변동이 있을 경우 꼭! feature 브랜치를 rebase 해주세요.
현재 시점에서 Merge 시 Conflict의 위험이 있습니다.

Copy link
Contributor Author

@nakyoung98 nakyoung98 Mar 16, 2024

Choose a reason for hiding this comment

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

image

툴팁 표시를 위해서 title={label}이 추가되었습니다

외에는 안보셔도 됩니다

label: string;
onClick: (e: MouseEvent<HTMLDivElement>) => void;
label: string;
onDelete: (stack: string) => void;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

onClick이 onDelete로 조금 더 명확한 이름으로 바뀌었습니다
외에는 안보셔도 됩니다

Copy link
Contributor Author

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} />
Copy link
Contributor Author

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";
Copy link
Contributor Author

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 =
Copy link
Contributor Author

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>
Copy link
Contributor Author

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");
Copy link
Contributor Author

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)}
Copy link
Contributor Author

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) => {
Copy link
Contributor Author

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));
Copy link
Contributor Author

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"`};
Copy link
Contributor Author

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)`
Copy link
Contributor Author

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 =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

filter값에 따라 filter됩니다
ALL은 다 노출돼요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

더 범용적으로 만들 수도 있을 것 같은데, 우선 딱히 쓰는 곳은 없어서 Stack 특성화로 만들어져있습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

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

실제 버튼 쓰실 땐 이거 가져다가 쓰시면 됩니다

@nakyoung98 nakyoung98 closed this Mar 16, 2024
@nakyoung98 nakyoung98 deleted the feature/issue-65--Feat-기술스택-팝오버-구현 branch March 16, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant