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

feat-fe: Sidebar 컴포넌트 개선 #773

Merged
merged 13 commits into from
Oct 10, 2024
Merged

feat-fe: Sidebar 컴포넌트 개선 #773

merged 13 commits into from
Oct 10, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 7, 2024

목적

대시보드 및 공고 화면 좌측 사이드바 개선합니다.

작업 세부사항

  • Sidebar를 닫고 열 수 있습니다.
  • Sidebar내부 UI 구조를 변경합니다. 세부사항이 체크된다면 피그마를 통해서 확인하세요.
  • 배경 레이아웃을 삭제합니다.
  • 그외 나머지 컴포넌트들의 UI에 문제가 없어야 합니다.

참고 사항

아래의 별표줄 밑에 요구사항 ID만 작성해주세요. Prefix 금지!


COM_SIDEBAR

closes #772

기술 공유 사항

DashboardLayout은 Sidebar 섹션과 Main 섹션으로 나뉩니다. Main섹션은 full스크린 에서 Sidebar만큼 width값을 뺀 크기를 차지해야 합니다.

  1. flex:1 -> 내부 컴포넌트가 가로로 길어짐에 따라 MainContainer에 스크롤바가 생깁니다. 따라서 width값을 지정해줘야 합니다.
  2. Sidebar에 ref를 달고, getBoundingClientRect()메서드를 감지하는 옵저버를 만들었습니다 (useElementRect)

피드백 받고 싶어요.

image 아이콘이 적절하지 못하다는 느낌은 드는데, 더 적절한 이모지를 찾기가 어렵네요. 괜찮으시다면 패스, 아니시면 의견 남겨주세요!

@github-actions github-actions bot added feature 새로운 기능 frontend 프론트엔드 labels Oct 7, 2024
Copy link
Contributor Author

github-actions bot commented Oct 9, 2024

1728478745.813049

Copy link
Contributor Author

github-actions bot commented Oct 9, 2024

1728478749.440239

Copy link
Contributor Author

1728522108.324619

Copy link
Contributor

@seongjinme seongjinme left a comment

Choose a reason for hiding this comment

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

러기 고생하셨어요! 공고 상태 관리 관련하여 한 가지 궁금한 게 있어 일단 코멘트 먼저 드릴게요. 기능이나 디자인 측면에서는 모두 의도하신대로 잘 구현된 것 같습니다.

오픈되어 있는 공고가 하나도 없는 경우에는 "모집 공고" 버튼 아래로 영역 전체가 텅 비게 될텐데요, 이 부분을 어떻게 처리할지는 기획 측면의 이슈여서 저도 고민해 보겠습니다.

아이콘 부분에 대한 제 의견은 다음과 같습니다.

  • React-Icons의 아이콘들을 여럿 살펴봤는데, 러기가 선택해주신 아이콘 이상으로 공고 상태의 의미가 잘 드러나는 아이콘을 찾기는 어려웠어요.
  • 마감된 공고에 한해서는, 체크 표시보다는 자물쇠 표기가 어떨까 제안드려 봅니다.
    image
  • 아이콘들의 사이즈가 글자 대비 크게 느껴져서, 이것의 크기를 조금 줄이는 방안을 제안드려 볼게요.

Comment on lines +9 to 12
export interface RecruitmentStatusObject {
status: RecruitmentStatusType;
isPending: boolean;
isOngoing: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

공고가 가질 수 있는 3가지 상태에 대해 각기 다른 boolean 필드로 정의해 주셨네요. 유니언 타입이 아니라 이렇게 상태별 필드값을 따로 가져야 할 이유가 있을까요? 하나의 status에 대한 관리를 isPending, isOngoing, isClosed의 3개 필드로 관리하시는게 DX 측면에서 번거로우시진 않을까 하여 여쭤봅니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분은 개발자가 선택적으로 사용할 수 있게 만들어서 오히려 관리하기 편하다고 생각했는데요! 예를들어 if문을 사용하는 경우를 본다면,

if(Recruitment.isPending) {}
if(Recruitment.status === "Pending") {} // string을 상수로 분리해주어야하는 번거로움

이렇게 두 가지 경우를 사용할 수 있을거라 생각했어요. 또 이번에 만든 Icon 객체인

const IconObj: Record<RecruitmentStatusObject['status'], IconType> = {
    Pending: GrDocumentTime,
    Ongoing: GrDocumentUser,
    Closed: GrDocumentVerified,
  };

const Icon = iconObj[status]

이런 형식으로 사용할 수도 있으니, 두 가지 경우를 모두 사용한다면 유연하게 사용할 수 있어서 좋지 않을까? 생각해요.

사용하는 입장에선,필드값이 몇개인지 생각할 필요 없이 단순히 사용하는 값을 가져오기만 하면 되니 개발경험 측면에서도 전혀 번거롭지 않다고 생각해요!

아르가 말씀해주신 'DX 측면에서 번거로우시진 않을까'에 대해서 공감하지 못하고 있는데, 혹시 어떤 상황을 말씀하시는지가 궁금하네용!

Copy link
Contributor

Choose a reason for hiding this comment

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

개별 공고에 대한 상태를 정의한 유니온 타입의 RecruitmentStatusType이 이미 있는데, 여기에 각 상태별 boolean 값을 별도의 필드로 하나씩 떼어서 RecruitmentStatusObject를 따로 정의하신 것이 이후의 상태 관리에 번거로움을 더하진 않을까 우려되어서 드린 말씀이었어요.

전체 코드를 보니 Recruitment.status === "Pending"Recruitment.isPending으로 줄이는 것 이외의 이점은 크게 없어보이는데, 이에 비해 getTimeStatus의 리턴값으로는 { status: 'Pending'} 대신 { status: 'Pending', isPending: true, isOngoing: false, isClosed: false }이 되는 트레이드 오프가 있어 보였거든요.

현재로서는 관리해야 할 상태의 종류가 3개 뿐이고, 추후 변동될 가능성도 많지 않아서 관리 포인트에 큰 문제가 생길 것 같진 않습니다. 일단 요렇게 유지하되, 추후에 공고 관련 상태에 대해 변경해야 할 사안이 생기면 다시 검토해도 좋을 것 같습니다.

Copy link
Contributor

@llqqssttyy llqqssttyy left a comment

Choose a reason for hiding this comment

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

긋~

<S.Divider />

{sidebarContentList.map(({ title, posts }) => {
if (posts.length === 0) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

'렌더링하지 않는다'는 return null로 명시적으로 표현해주세요.

@lurgi lurgi requested a review from seongjinme October 10, 2024 05:54
Copy link
Contributor

@seongjinme seongjinme left a comment

Choose a reason for hiding this comment

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

러기 정말 고생하셨어요. 디자인과 기능성 모두 꼼꼼히 챙겨주신 덕분에 멋진 사이드바가 생긴 것 같습니다. Approve 드릴게요 🙏

Comment on lines +39 to +41
const pendingPosts = useMemo(() => options?.filter(({ status }) => status.isPending), [options]);
const onGoingPosts = useMemo(() => options?.filter(({ status }) => status.isOngoing), [options]);
const closedPosts = useMemo(() => options?.filter(({ status }) => status.isClosed), [options]);
Copy link
Contributor

Choose a reason for hiding this comment

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

useMemo 👍

@lurgi lurgi merged commit b0b02e1 into fe/develop Oct 10, 2024
24 of 26 checks passed
@lurgi lurgi deleted the fe-772-COM_SIDEBAR branch October 10, 2024 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 frontend 프론트엔드
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

3 participants