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]: 타이포그라피 테일윈드 css 스타일 구현, 타이포그라피 컴포넌트 구현 #36

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

jangwonyoon
Copy link
Collaborator

@jangwonyoon jangwonyoon commented Feb 27, 2025

📌 개요

close #35

📋 변경사항

기능

  • 티아포그라피 디자인 시스템 추가
  • 티아포그라피 컴포넌트 추가

화면

| 기능 | 스크린샷 |
스크린샷 2025-02-27 오후 10 31 48

| ---- | -------- |

사용방법

  • 커밋에 예시 사용 페이지가 있습니다.

  • tailwindcss style 직접 적용

  <div className='text-title-1'>세민이는 타이틀은 멋졍</div>
  <div className='text-title-2'>세민이는 타이틀은 멋졍</div>
  <div className='text-title-3'>세민이는 타이틀은 멋졍</div>
  <div className='text-title-3'>세민이는 타이틀은 멋졍</div>

  <div>### body</div>
  <div className='text-body-1'>세민이는 바디는 멋졍</div>
  <div className='text-body-2'>세민이는 바디는 멋졍</div>
  <div className='text-body-3'>세민이는 바디는 멋졍</div>

  <div>### caption</div>
  <div className='text-caption-1'>세민이는 캡션은 멋졍</div>
  <div className='text-caption-2'>세민이는 캡션은 멋졍</div>
  • 타이포그라피 컴포넌트 적용
  <Typography variant='title-1'>세민이는 타이틀은 멋졍</Typography>
  <Typography variant='title-2'>세민이는 타이틀은 멋졍</Typography>
  <Typography variant='title-3'>세민이는 타이틀은 멋졍</Typography>

  <Typography variant='body-1'>세민이는 바디는 멋졍</Typography>
  <Typography variant='body-2'>세민이는 바디는 멋졍</Typography>
  <Typography variant='body-3'>세민이는 바디는 멋졍</Typography>

  <Typography variant='caption-1'>세민이는 캡션은 멋졍</Typography>
  <Typography variant='caption-2'>세민이는 캡션은 멋졍</Typography>
  • 타이포그라피 컴포넌트는, as props를 통해 span, p, div 등의 다양한 태그를 지원합니다.
  • 현재 variant로 넘겨주고 있는데, 좀더 명시적으로 나타내길 원하시면 코멘트 부탁드립니다.

✅ 체크사항

  • 기능이 정상적으로 동작하는지 확인
  • 코드 스타일 및 규칙 준수 확인
  • UI가 변경된 경우 스크린샷 첨부 여부 확인

✅ 코드리뷰 사항

  • 시스템 구축에 궁금한 사항 있으면, 가감없이 코멘트 부탁드립니다.
  • gitmogi 커밋이 아직 익숙하지 않아 차차 적용해나가겠습니다 양해부탁드려요 😂

Summary by CodeRabbit

Summary by CodeRabbit

  • 새로운 기능
    • Took 디자인 시스템 기반의 새로운 Typography 컴포넌트를 추가하여 다양한 텍스트 스타일을 손쉽게 적용할 수 있게 되었습니다.
    • 텍스트 스타일 유틸리티와 함께 제목, 본문, 캡션 등 여러 스타일 변형을 지원하여 디자인 일관성을 강화했습니다.
    • Tailwind CSS 설정에 새로운 폰트 크기 옵션을 추가하여 보다 세밀한 타이포그래피 제어가 가능해졌습니다.

@jangwonyoon jangwonyoon added ✅ Auto approve PR에 대한 Auto Approve입니다. 💄 style 스타일 labels Feb 27, 2025
@jangwonyoon jangwonyoon self-assigned this Feb 27, 2025
Copy link

coderabbitai bot commented Feb 27, 2025

📝 Walkthrough

"""

Walkthrough

이번 PR은 Took 디자인 시스템의 타이포그래피 스타일을 적용하기 위한 새로운 UI 컴포넌트와 관련 유틸리티, 그리고 Tailwind CSS 구성 업데이트를 포함합니다. Typography 컴포넌트는 as, children, variant 등의 프로퍼티를 받아 해당 HTML 태그와 스타일 클래스를 적용해 요소를 렌더링합니다. 추가로, class-variance-authority를 사용한 typography 유틸리티가 도입되어 타입 안정성을 제공하며, Tailwind CSS에는 다양한 제목, 본문, 캡션 스타일에 따른 폰트 크기 설정이 추가되었습니다.

Changes

파일 변경 내용
src/.../typography/index.tsx
src/.../typography/typography.ts
Took 디자인 시스템 스타일을 적용하는 Typography 컴포넌트와 typography 유틸리티 추가. 컴포넌트는 as, children, variant 등의 프로퍼티를 사용하며, 유틸리티는 다양한 텍스트 스타일 변형과 타입을 정의함.
tailwind.config.ts theme.extend 내에 새로운 fontSize 옵션을 추가하여 title, body, caption 등 다양한 텍스트 스타일의 폰트 크기, lineHeight, fontWeight, letterSpacing 설정을 제공함.

Sequence Diagram(s)

sequenceDiagram
    participant 사용자 as User
    participant TComp as Typography Component
    participant TUtil as Typography Utility
    사용자->>TComp: props (variant, as, children) 전달
    TComp->>TUtil: variant 기반 클래스명 생성 요청
    TUtil-->>TComp: CSS 클래스명 반환
    TComp->>사용자: 지정 태그로 스타일 적용 HTML 요소 렌더링
Loading

Suggested labels

🚀 feature

Suggested reviewers

  • JaeIn1
  • semnil5202
  • evenway2025
  • youngju6143
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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.

@jangwonyoon jangwonyoon changed the title Feature/#35 typography [style]: 타이포그라피 테일윈드 css 스타일 구현, 타이포그라피 컴포넌트 구현 Feb 27, 2025
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/typography/index.tsx (2)

3-6: 타입 이름 일관성 개선 제안

TypoGraphyProps 타입 이름에서 'G'가 대문자로 되어 있습니다. 일관성을 위해 TypographyProps로 변경하는 것이 좋을 것 같습니다.

-type TypoGraphyProps = TypographyVariantProps & {
+type TypographyProps = TypographyVariantProps & {
  as?: keyof JSX.IntrinsicElements;
  children: React.ReactNode;
};

19-22: 깔끔한 컴포넌트 구현, 좋습니다!

컴포넌트가 간결하고 효율적으로 구현되었습니다. as 속성을 사용하여 다양한 HTML 태그를 렌더링할 수 있는 유연성을 제공한 점이 좋습니다. 타입 일관성을 위해 함수 매개변수 타입을 선언부와 일치시키세요.

-export const Typography = ({ as: Tag = "span", variant, children }: TypoGraphyProps) => {
+export const Typography = ({ as: Tag = "span", variant, children }: TypographyProps) => {
  const className = typography({ variant });
  return <Tag className={className}>{children}</Tag>;
};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 31a1d95 and 27c875e.

📒 Files selected for processing (3)
  • src/shared/ui/typography/index.tsx (1 hunks)
  • src/shared/ui/typography/typography.ts (1 hunks)
  • tailwind.config.ts (1 hunks)
🔇 Additional comments (3)
src/shared/ui/typography/typography.ts (1)

1-24: 유용한 타이포그래피 유틸리티 구현, 좋은 작업입니다!

class-variance-authority를 활용한 타이포그래피 유틸리티가 잘 구현되었습니다. 다양한 텍스트 스타일 변형을 제공하고 기본값으로 'body-1'을 설정한 점이 좋습니다. 타입 안전성을 위해 TypographyVariantProps를 내보내는 것도 훌륭한 접근입니다.

typography('typography', { ... })에서 첫 번째 인자로 전달된 'typography' 클래스 이름이 실제로 사용되는지 확인해보세요. 필요하지 않다면 생략해도 될 수 있습니다.

src/shared/ui/typography/index.tsx (1)

8-17: 잘 작성된 JSDoc 문서화, 훌륭합니다!

컴포넌트의 목적, 매개변수, 반환 값에 대한 명확한 설명을 포함한 JSDoc 문서가 잘 작성되었습니다. 이러한 문서화는 코드 가독성과 유지보수성을 크게 향상시킵니다.

tailwind.config.ts (1)

84-99: 체계적인 타이포그래피 시스템 구현, 훌륭합니다!

Tailwind CSS의 fontSize 설정을 활용하여 체계적인 타이포그래피 시스템을 구현한 점이 매우 좋습니다. 각 스타일에 대해 fontSize, lineHeight, fontWeight, letterSpacing을 상세히 지정하여 디자인 시스템에 일관성을 부여했습니다.

한 가지 확인할 점은 body-3body-4의 설정이 완전히 동일합니다. 이것이 의도적인 설계인지 확인해 보세요. 각각 다른 목적을 가지고 있다면 시각적으로 구분될 수 있도록 설정에 약간의 차이를 두는 것이 좋을 수 있습니다.

@jangwonyoon jangwonyoon added the 🚀 feature 새로운 기능 개발 label Feb 27, 2025
@jangwonyoon jangwonyoon changed the title [style]: 타이포그라피 테일윈드 css 스타일 구현, 타이포그라피 컴포넌트 구현 [feature]: 타이포그라피 테일윈드 css 스타일 구현, 타이포그라피 컴포넌트 구현 Feb 27, 2025
Copy link
Member

@Jungjjeong Jungjjeong left a comment

Choose a reason for hiding this comment

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

장원짱 🍀

Copy link
Collaborator

@youngju6143 youngju6143 left a comment

Choose a reason for hiding this comment

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

너무 좋아요...! 🥹🥹
따로 리뷰 남길 만한게 보이지 않네요!
너무 수고 많으셨어요 😄

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/typography/index.tsx (2)

8-17: JSDoc 주석이 상세하게 작성되어 있습니다.

컴포넌트와 각 props에 대한 설명이 잘 문서화되어 있습니다. 다만, as prop의 타입이 실제 타입 정의(keyof JSX.IntrinsicElements)와 JSDoc(React.ElementType)에서 약간 다릅니다. 정확성을 위해 일치시키는 것이 좋을 것 같습니다.

- * @param {React.ElementType} [props.as=span] - 렌더링할 HTML 태그를 지정합니다. 기본값은 `span`입니다. div, span, p 등의 태그를 사용할 수 있습니다.
+ * @param {keyof JSX.IntrinsicElements} [props.as=span] - 렌더링할 HTML 태그를 지정합니다. 기본값은 `span`입니다. div, span, p 등의 태그를 사용할 수 있습니다.

19-22: 컴포넌트 구현이 간결하고 효과적입니다.

Typography 컴포넌트가 명확한 책임을 가지고 있으며, 리액트 Best Practices를 잘 따르고 있습니다. 하지만 추가적인 HTML 속성(예: id, aria-attributes 등)을 전달할 수 없습니다. 필요에 따라 나머지 props를 전달하는 것이 좋을 수 있습니다.

- export const Typography = ({ as: Tag = "span", variant, children }: TypographyProps) => {
-   const className = typography({ variant });
-   return <Tag className={className}>{children}</Tag>;
+ export const Typography = ({ as: Tag = "span", variant, children, ...rest }: TypographyProps & JSX.IntrinsicElements[keyof JSX.IntrinsicElements]) => {
+   const className = typography({ variant });
+   return <Tag className={className} {...rest}>{children}</Tag>;

이 변경사항을 통해 어떤 HTML 속성도 Typography 컴포넌트에 전달할 수 있게 됩니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27c875e and 63cee60.

📒 Files selected for processing (1)
  • src/shared/ui/typography/index.tsx (1 hunks)
🔇 Additional comments (2)
src/shared/ui/typography/index.tsx (2)

1-1: 임포트가 잘 구성되어 있습니다.

typography 유틸리티와 타입을 적절히 임포트하여 사용하고 있습니다.


3-6: 타입 정의가 명확하게 되어 있습니다.

TypographyProps 타입이 TypographyVariantProps를 확장하고 필요한 추가 속성을 포함하고 있어 타입 안전성을 보장합니다.

@jangwonyoon jangwonyoon merged commit f37665e into develop Feb 28, 2025
3 checks passed
@jangwonyoon jangwonyoon deleted the feature/#35-typography branch February 28, 2025 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Auto approve PR에 대한 Auto Approve입니다. 🚀 feature 새로운 기능 개발 💄 style 스타일
Projects
None yet
Development

Successfully merging this pull request may close these issues.

공통 스타일 타이포그라피 구현
3 participants