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] Skeleton 컴포넌트 개발, 스토리북 제작 #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yougyung
Copy link
Collaborator

@yougyung yougyung commented Jan 30, 2025

🔥 연관 이슈

🚀 작업 내용

스크린샷 2025-01-31 오전 8 27 05 - Skeleton 컴포넌트 개발 및 스토리북 생성

🤔 고민했던 내용

속성 제거

반응형을 고려하면서

  1. width, height, border-radius을 속성으로 받도록 구현(789cbfa)했지만,
  2. 아래의 이유로 className으로 처리하는 것이 유리할 것 같다는 생각이 들어 변경했어요. 6023c19

1. tailwind는 동적 className생성을 권장하지않는다
2. 우리 서비스는 일반적으로 반응형 처리를 요구하므로, 명시적 작성으로 누릴 효과가 적다.
3. 각 속성을 유형화하기 어렵다.

폴더 구조

  • skeleton파일(ex. 픽스존.skeleton.tsx)을 어디에 위치시키면 좋을 지, 다음 회의 때 구두로 논의하면 좋을 것 같아요

기본 값

  • 내부 기본값에 대한 이해 없이도 명시적으로 알 수 있도록 size(width, height)에 대한 기본값을 설정하지 않았어요.

💬 리뷰 중점사항

  • 속성 제거에 대한 팀원분들의 생각이 궁금해요

Summary by CodeRabbit

  • 새로운 기능

    • 레이아웃의 로딩 상태를 표시하는 스켈레톤 컴포넌트 추가
    • 데이터 로딩 전 화면에 임시 플레이스홀더 제공
  • 문서화

    • Storybook에 스켈레톤 컴포넌트 문서 추가
    • 컴포넌트 사용 방법 및 기본 설정 정의

@yougyung yougyung self-assigned this Jan 30, 2025
@yougyung yougyung linked an issue Jan 30, 2025 that may be closed by this pull request
2 tasks
Copy link

coderabbitai bot commented Jan 30, 2025

Walkthrough

이 풀 리퀘스트는 새로운 Skeleton 컴포넌트를 도입하고 있습니다. Skeleton 컴포넌트는 데이터 로딩 중 레이아웃의 플레이스홀더로 사용되며, Storybook을 통해 문서화되었습니다. 컴포넌트는 기본 스타일과 함께 추가 CSS 클래스를 지원하며, 애니메이션 효과를 포함하고 있습니다.

Changes

파일 변경 요약
src/shared/ui/Skeleton/Skeleton.tsx Skeleton 컴포넌트 생성, props 타입 정의, 기본 스타일 및 애니메이션 추가
src/shared/ui/Skeleton/Skeleton.stories.tsx Storybook 메타데이터 및 기본 스토리 추가
src/shared/ui/Skeleton/index.ts Skeleton 컴포넌트 내보내기

Assessment against linked issues

목표 해결 여부 설명
Skeleton 컴포넌트
Skeleton 스토리북

Possibly related PRs

Suggested labels

feat

Suggested reviewers

  • keemsebin
  • ujinsim

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Update: 2025년 01월 31일 08시 33분 02초
Storybook 미리보기: https://677a9a76c58a295e9421d3ef-qrobwiyehg.chromatic.com/

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/shared/ui/Skeleton/Skeleton.tsx (1)

10-12: 접근성 개선을 위한 aria 속성 추가 필요

스켈레톤 UI는 로딩 상태를 나타내는 중요한 UI 요소이므로, 스크린 리더 사용자를 위한 접근성 속성을 추가하는 것이 좋습니다.

 export function Skeleton({ className, ...props }: Props) {
-  return <div className={cn('animate-pulse rounded-md bg-gray-200', className)} {...props} />;
+  return (
+    <div
+      className={cn('animate-pulse rounded-md bg-gray-200', className)}
+      role="status"
+      aria-label="로딩 중..."
+      {...props}
+    />
+  );
 }
src/shared/ui/Skeleton/Skeleton.stories.tsx (1)

22-33: 스토리 구현에 대한 개선 제안

기본 사용 예시는 잘 구현되어 있으나, 다양한 크기와 사용 사례를 보여주는 추가 스토리가 있으면 좋을 것 같습니다.

다음과 같은 추가 스토리 구현을 제안드립니다:

export const Variants: Story = {
  render: () => {
    return (
      <div className="space-y-4">
        <Skeleton className="h-4 w-3/4" />
        <Skeleton className="h-8 w-1/2" />
        <Skeleton className="h-32 w-full" />
      </div>
    );
  },
};

export const WithCustomAnimation: Story = {
  args: {
    className: 'h-8 w-full animate-[pulse_2s_ease-in-out_infinite]'
  },
};
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9903e02 and 6023c19.

📒 Files selected for processing (3)
  • src/shared/ui/Skeleton/Skeleton.stories.tsx (1 hunks)
  • src/shared/ui/Skeleton/Skeleton.tsx (1 hunks)
  • src/shared/ui/Skeleton/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/shared/ui/Skeleton/index.ts
🔇 Additional comments (2)
src/shared/ui/Skeleton/Skeleton.tsx (1)

3-8: Props 타입 정의가 명확하고 잘 문서화되어 있습니다.

컴포넌트의 Props 타입이 잘 정의되어 있으며, className prop에 대한 JSDoc 문서화도 적절합니다.

src/shared/ui/Skeleton/Skeleton.stories.tsx (1)

5-17: 스토리북 메타데이터가 잘 구성되어 있습니다.

컴포넌트 설명이 한글로 명확하게 작성되어 있고, autodocs 태그를 통한 자동 문서화 설정이 적절합니다.

Copy link
Contributor

@keemsebin keemsebin left a comment

Choose a reason for hiding this comment

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

저도 두번째 방식이 더 좋은 것 같습니다!

텍스트의 경우 스켈레톤을 사용할 때 살짝 아쉬운 부분이 있는 것 같아요! 원인 경우는 rounded-full을 적용할 수 있지만, 텍스트의 경우는 h-2 rounded 사용한 스켈레톤을 여러개 추가해야하지 않을까 싶어요. 어떻게 생각하시나요??
스크린샷 2025-02-01 오전 2 32 45

@yougyung yougyung added the feat label Feb 3, 2025
Copy link
Collaborator

@ujinsim ujinsim left a comment

Choose a reason for hiding this comment

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

저도 동일하게 className으로 사용하는 것이 좋네요
수고하셨습니다 ~~

@yougyung
Copy link
Collaborator Author

yougyung commented Feb 5, 2025

텍스트의 경우 스켈레톤을 사용할 때 살짝 아쉬운 부분이 있는 것 같아요! 원인 경우는 rounded-full을 적용할 수 있지만, 텍스트의 경우는 h-2 rounded 사용한 스켈레톤을 여러개 추가해야하지 않을까 싶어요. 어떻게 생각하시나요??

형태가 고정되어져있고,개수만 차이를 갖는다면 말씀하신 것처럼 일괄로 처리를 하는게 더 좋아보여요.
text와 함께 추가로 진행하면 좋을 유형이 또 있을까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] Skeleton 컴포넌트, 스토리북
3 participants