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

design: Organism 컴포넌트 개발 (Header, BalanceGameList) #151

Merged
merged 28 commits into from
Aug 7, 2024

Conversation

alwubin
Copy link
Collaborator

@alwubin alwubin commented Aug 6, 2024

💡 작업 내용

  • Notification UI 수정
  • Header UI 구현
  • BalanceGameCategoryButton, CategoryBar UI 구현
  • BalanceGameList UI 구현
  • 구현한 컴포넌트 스토리북에 추가

💡 자세한 설명

✅ Notification

<NotificationButton css={buttonStyle} onClick={handleNotification} />
{isOpen ? (
        <div css={notificationStyle}>
          <div css={titleStyle}>알림</div>
          <div css={notificationContentStyle}>
            {notifications.map((notification) => (
              <div css={notificationItemStyle}>
                <NotificationItem
                  category={notification.category}
                  date={notification.date}
                  title={notification.title}
                  content={notification.content}
                  isNew={notification.isNew}
                />
              </div>
            ))}

헤더에 알림 버튼(종소리 모양) 클릭 시 이전에 구현해놓은 NotificationList가 출력되도록 수정해놓았습니다.

✅ BalanceGameList

export interface ContentItemProps {
  optionAImg?: string;
  optionBImg?: string;
  id: number;
  title: string;
  tagLabels: string[];
  bookmarkState?: boolean;
  optionA?: string;
  optionB?: string;
}

api가 수정된 부분에 맞추어 수정해놓았지만, 옵션 값들에 대한 ImgUrl이 확실하지 않아 (등록하지 않을 시 기본 제공되는 이미지.. 등등) 추후 변경된 값 재적용 필요합니다.

✅ BalanceGameCategoryButton

      <BalanceGameCategoryButton
        label="인기"
        icon={<Popular />}
        active={activeTab === 'Popular'}
        badgeText={getBadgeText('Popular')}
        onClick={() => setActiveTab('Popular')}
      />

여기서의 label은 실제 카테고리 바에 출력되는 버튼명과 같아서 영어로 수정하지 않았습니다. 혹시 더 괜찮은 아이디어 있으면 알려주시면 감사하겠습니다.

📗 참고 자료 (선택)

📢 리뷰 요구 사항 (선택)

🚩 후속 작업 (선택)

✅ 셀프 체크리스트

  • PR 제목을 형식에 맞게 작성했나요?
  • 브랜치 전략에 맞는 브랜치에 PR을 올리고 있나요? (master/main이 아닙니다.)
  • 이슈는 close 했나요?
  • Reviewers, Labels, Projects를 등록했나요?
  • 작업 도중 문서 수정이 필요한 경우 잘 수정했나요?
  • 테스트는 잘 통과했나요?
  • 불필요한 코드는 제거했나요?

closes #147

@alwubin alwubin added ✔︎pull requests pull requests 코드 체크 요청 👩🏻‍💻 frontend 프론트엔드 작업 🎨 markup labels Aug 6, 2024
@alwubin alwubin self-assigned this Aug 6, 2024
Copy link
Collaborator

@WonJuneKim WonJuneKim left a comment

Choose a reason for hiding this comment

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

이번 구현도 고생 많으셨습니다 👍
Header, BalanceGameList 관련된 내용 찬찬히 살펴보고 코멘트 남겼습니다 한번 확인해주시면 감사하겠습니다!! 😆
카테고리 바도 정말 이쁜거같아욥ㅎㅎㅎ

Comment on lines +53 to +59
export const inactiveLineStyle = (label: string) => {
let borderRadius = '0';
if (label === '인기') {
borderRadius = '10px 0 0 10px';
} else if (label === '월드컵') {
borderRadius = '0 10px 10px 0';
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

const popularStyle = css`
  border-radius: 10px 0 0 10px;
`;

const worldCupStyle = css`
  border-radius: 0 10px 10px 0;
`;

const inactiveLineStyle = (label: string) => {
  switch (label) {
    case '인기':
      return popularStyle;
    case '월드컵':
      return worldCupStyle;
    default:
      return baseStyle;
  }
};

(스타일 네이밍은 임의로 지정해봤어요)
저 같은 경우에는 조건부 스타일은 이런식으로 처리하는 경우가 많은데, if 문 쓰는 방식도 있었군요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

원래는 삼항연산자를 쓰는걸 좋아하는데, multi 삼항연산자에 대한 eslint가 있어서 수정했답니다ㅎㅎ.. 근데 저 borderRadius 부분만 추가되고 나머지 기본 style은 네가지 모두 동일하게 사용해서 조건문으로 사용해보았습니다! switch문도 좋은 방법 중 하나네용😄

Comment on lines 12 to 18
const BalanceGameCategoryButton: React.FC<ButtonProps> = ({
label,
icon,
active,
badgeText,
onClick,
}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

최근에는 React.FC를 통한 선언 방법 보다는

const BalanceGameCategoryButton = ({
  label,
  icon,
  active,
  badgeText,
  onClick,
}: ButtonProps) => {

와 같이 명시적으로 props을 선언해주는 방식이 더 권장된다고 하더라구요!
한번 참고해주시면 좋을거 같습니다 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

권장되는 방식이라니! 몰랐어용 수정해놓도록 할게요😅

Comment on lines +12 to +20
export interface ContentItemProps {
imgUrl?: string[];
id: number;
title: string;
tagLabels: string[];
bookmarkState?: boolean;
optionA?: string;
optionB?: string;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ImgUrl 코멘트 남겨주신 부분 확인했습니다!

Comment on lines +32 to +34
width: '100.24px',
height: '32.92px',
marginRight: '7.76px',
Copy link
Collaborator

Choose a reason for hiding this comment

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

제 에디터에서는 소숫점으로 디자인을 선언하니까 브라우저마다 반영되는게 다를 수도 있다고 경고 문고 뜨더라구요! 혹시 이런 에러나 경고 메시지 뜨시지 않았는지 궁금합니다!
(피그마에서 이렇게 소숫점으로 되어있는 부분들이 있을 때마다 경고 메시지가 떠서 질문드려욥!!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아뇨?! 소수점에 대한 따로 경고문은 보지 못했어요, 저는 크롬 사용하고있는데 다른 브라우저에서는 경고문이 따로 뜨는걸까욥?!

Copy link
Collaborator

@areumH areumH left a comment

Choose a reason for hiding this comment

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

컴포넌트 구현하시느라 수고 많으셨어요!!!! 카테고리 바 너무 이쁘네요 👍👍

Comment on lines +22 to +24
export interface ContentListProps {
contents: ContentItemProps[];
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

api로 받아오는 데이터의 타입은 추후에 확정된 후 types/game.ts 파일 내의 타입 수정 후 임포트해와서 사용하는 방식으로 수정하면 좋을 것 같습니다!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵, 확인했습니다!

Comment on lines 41 to 43
const handleLoadMore = () => {
setVisibleItems((prev) => Math.min(prev + 2, contents.length));
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

현재 피그마의 정의서에 따르면 더보기 1회 클릭 시 게임 카드가 6개 추가되는 것으로 나와있어요!!! 개수 수정 부탁드립니다 😊

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아정말요?! 수정해놓도록 하겠습니다! ☺️

@alwubin alwubin merged commit cc6e6ac into dev Aug 7, 2024
3 checks passed
@alwubin alwubin deleted the design/147-organism-ui-yb branch October 1, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👩🏻‍💻 frontend 프론트엔드 작업 🎨 markup ✔︎pull requests pull requests 코드 체크 요청
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Organism 컴포넌트 개발 (Header, BalanceGameCard)
3 participants