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] 주제설정 변경사항 구현, GradientAnimatedText ui 패키지로 이관 및 개선, Label 컴포넌트 옵션 추가 #127

Merged
merged 6 commits into from
Feb 13, 2025

Conversation

minseong0324
Copy link
Contributor

@minseong0324 minseong0324 commented Feb 13, 2025

관련 이슈

close: #126

변경 사항

아래의 작업을 진행했어요.

  1. GradientAnimatedText packages/ui 폴더로 이관 및 개선
  2. Label 컴포넌트 옵션 추가
  3. RadioCards disabled 색상 변경
  4. 주제설정 변경사항 구현

GradientAnimatedText를 사용하기 좋게 ui 패키지로 이관했어요. slot 패턴을 활용해서 다양한 html 태그로 GradientAnimatedText를 활용할 수 있고, 기본 태그는 h1이에요.

// 기본 사용 (h1)
<GradientAnimatedText>제목</GradientAnimatedText>

// 다른 태그로 사용
<GradientAnimatedText asChild>
  <Text.P>제목</Text.P>
</GradientAnimatedText>

레퍼런스

Summary by CodeRabbit

  • 새로운 기능

    • 기존 애니메이션 타이틀 대신 새롭게 개선된 애니메이션 텍스트 효과로 타이틀이 보다 부드럽게 표시됩니다.
    • “본문 길이” 라벨에 구독 플랜 관련 설명이 추가되어 옵션 선택 시 정보를 명확하게 전달합니다.
    • 글 길이 옵션 표시 방식이 간소화되어 UI 가독성이 향상되었습니다.
  • 스타일

    • 제목 레이아웃이 전체 폭을 활용하며 중앙 정렬로 개선되어 시각적 일관성이 강화되었습니다.
    • 라벨 구성 요소에 설명 텍스트 추가 기능이 도입되어 사용성을 향상시켰습니다.
    • 비활성 상태 옵션의 색상이 조정되어 보다 명확한 구분과 향상된 사용자 경험을 제공합니다.

Copy link

coderabbitai bot commented Feb 13, 2025

Walkthrough

이 PR은 사용자 인터페이스 개선을 위해 Create 페이지와 관련 컴포넌트들을 업데이트합니다.
주요 변경 사항은 기존의 GradientAnimatedTitle 컴포넌트를 제거하고, 대신 새로운 GradientAnimatedText 컴포넌트를 도입한 것과 Label 컴포넌트에 설명을 추가한 점입니다.
또한, LENGTH_OPTIONS 배열에서 badge 속성을 제거하여 옵션 매핑을 단순화하였으며, 새로운 스타일(titleStyle, labelWrapperStyle)이 추가되었습니다.
RadioCards의 비활성 상태 색상값도 일부 업데이트되었고, UI 패키지에 새로운 컴포넌트 export가 포함되었습니다.

Changes

File(s) Change Summary
apps/web/src/app/create/Create.tsx
apps/web/src/app/create/_components/GradientAnimatedTitle/…/GradientAnimatedTitle.tsx
apps/web/src/app/create/constants.ts
apps/web/src/app/create/pageStyle.css.ts
Create 페이지에서 GradientAnimatedTitle 제거 및 GradientAnimatedText 적용, Label에 설명 추가, LENGTH_OPTIONSbadge 속성 제거, 새로운 titleStyle 추가.
packages/ui/package.json
packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.css.ts
packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx
packages/ui/src/components/GradientAnimatedText/index.ts
packages/ui/src/components/index.ts
새로운 GradientAnimatedText 컴포넌트 추가 및 관련 스타일 업데이트 (width 추가, textAlign 및 padding 제거)와 export 설정.
packages/ui/src/components/Label/Label.css.ts
packages/ui/src/components/Label/Label.tsx
Label 컴포넌트에 새로운 description prop 도입 및 labelWrapperStyle 추가.
packages/ui/src/components/RadioCards/RadioCardsDescription.tsx
packages/ui/src/components/RadioCards/RadioCardsLabel.tsx
RadioCards 컴포넌트의 비활성 상태 색상 변경 (grey400 → grey200/grey300).

Sequence Diagram(s)

sequenceDiagram
    participant U as 사용자
    participant CP as Create 페이지
    participant GT as GradientAnimatedText
    participant L as Label 컴포넌트

    U->>CP: Create 페이지 접근
    CP->>GT: "어떤 글을 생성할까요?" 애니메이션 타이틀 렌더링 요청
    GT-->>CP: 애니메이션 타이틀 전달
    CP->>L: Label 컴포넌트 렌더링 (설명 포함)
    L-->>CP: Label 렌더링 완료
Loading

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • kongnayeon

Poem

토끼 한 마리 귀엽게 뛰며,
코드 숲속을 즐겁게 달려요.
새 컴포넌트 빛나듯 반짝이고,
Label의 설명은 마음을 채워요.
변화의 길 위에 행복이 넘쳐나요! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx

Oops! Something went wrong! :(

ESLint: 9.17.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@repo/eslint-config' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba6b30 and f153315.

📒 Files selected for processing (1)
  • packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@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: 2

🧹 Nitpick comments (4)
packages/ui/src/components/Label/Label.css.ts (1)

4-8: labelWrapperStyle의 gap 속성 개선 제안

현재 고정된 gap 값을 사용하고 있습니다. 반응형 디자인을 위해 미디어 쿼리를 통한 동적인 gap 조정을 고려해보시는 것은 어떨까요?

 export const labelWrapperStyle = style({
   display: 'flex',
   flexDirection: 'row',
-  gap: vars.space[12],
+  gap: {
+    '@media': {
+      'screen and (max-width: 768px)': { gap: vars.space[8] },
+      'screen and (min-width: 769px)': { gap: vars.space[12] }
+    }
+  },
 });
packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.css.ts (1)

3-10: 애니메이션 성능 최적화 제안

현재 애니메이션이 지속적으로 실행되고 있습니다. 성능 개선을 위해 다음 사항들을 고려해보세요:

  • will-change 속성 추가
  • transform 사용으로 변경
 const flowingGradient = keyframes({
   '0%': {
-    backgroundPosition: '0% 50%',
+    transform: translateX(0%),
   },
   '100%': {
-    backgroundPosition: '200% 50%',
+    transform: translateX(-100%),
   },
 });
apps/web/src/app/create/pageStyle.css.ts (1)

29-33: 반응형 디자인 개선 제안

현재 padding과 width가 고정값으로 설정되어 있습니다. 다양한 화면 크기에 대응하기 위해 반응형으로 개선하면 좋을 것 같습니다.

 export const titleStyle = style({
-  width: '100%',
+  width: {
+    '@media': {
+      'screen and (max-width: 768px)': { width: '90%' },
+      'screen and (min-width: 769px)': { width: '100%' }
+    }
+  },
-  padding: `${vars.space[24]} 0`,
+  padding: {
+    '@media': {
+      'screen and (max-width: 768px)': { padding: `${vars.space[16]} 0` },
+      'screen and (min-width: 769px)': { padding: `${vars.space[24]} 0` }
+    }
+  },
   textAlign: 'center',
 });
apps/web/src/app/create/Create.tsx (1)

44-46: TODO 주석을 처리해주세요.

agentId가 임시값으로 하드코딩되어 있습니다. 실제 값으로 교체가 필요합니다.

이 TODO를 추적할 이슈를 생성해드릴까요?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d914b8 and 5ba6b30.

📒 Files selected for processing (13)
  • apps/web/src/app/create/Create.tsx (3 hunks)
  • apps/web/src/app/create/_components/GradientAnimatedTitle/GradientAnimatedTitle.tsx (0 hunks)
  • apps/web/src/app/create/constants.ts (0 hunks)
  • apps/web/src/app/create/pageStyle.css.ts (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.css.ts (1 hunks)
  • packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx (1 hunks)
  • packages/ui/src/components/GradientAnimatedText/index.ts (1 hunks)
  • packages/ui/src/components/Label/Label.css.ts (1 hunks)
  • packages/ui/src/components/Label/Label.tsx (2 hunks)
  • packages/ui/src/components/RadioCards/RadioCardsDescription.tsx (1 hunks)
  • packages/ui/src/components/RadioCards/RadioCardsLabel.tsx (1 hunks)
  • packages/ui/src/components/index.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/web/src/app/create/_components/GradientAnimatedTitle/GradientAnimatedTitle.tsx
  • apps/web/src/app/create/constants.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/ui/src/components/GradientAnimatedText/index.ts
🔇 Additional comments (11)
packages/ui/src/components/RadioCards/RadioCardsLabel.tsx (1)

17-17: 비활성화 상태의 색상 변경이 적절해 보입니다!

grey400에서 grey300으로의 색상 변경은 비활성화된 라벨의 가시성을 개선하며, 디자인 시스템의 일관성을 유지합니다.

packages/ui/src/components/RadioCards/RadioCardsDescription.tsx (1)

17-17: 시각적 계층 구조가 개선되었습니다!

grey400에서 grey200으로의 색상 변경은 다음과 같은 이점이 있습니다:

  • Label(grey300)과 Description(grey200) 사이의 시각적 계층 구조가 명확해졌습니다
  • 비활성화된 상태에서도 텍스트 요소 간의 관계가 잘 표현됩니다
packages/ui/src/components/index.ts (1)

17-17: 새로운 GradientAnimatedText 컴포넌트 export가 적절히 추가되었습니다!

알파벳 순서에 맞게 잘 배치되어 있으며, 기존 export 패턴을 일관되게 따르고 있습니다.

packages/ui/src/components/Label/Label.tsx (3)

12-15: Props 인터페이스가 적절하게 확장되었습니다.

설명 텍스트를 지원하기 위해 description prop이 ReactNode 타입으로 추가되었습니다.


23-42: 문서화가 잘 되어있습니다.

JSDoc 예제가 명확하고 이해하기 쉽게 작성되어 있습니다.


49-78: 레이블 래퍼 구조가 적절합니다.

description 텍스트를 위한 래퍼 div와 스타일링이 잘 구현되어 있습니다.

packages/ui/src/components/GradientAnimatedText/GradientAnimatedText.tsx (2)

6-9: Props 인터페이스가 명확합니다.

asChild prop을 통한 다형성 지원이 잘 구현되어 있습니다.


11-23: 문서화가 잘 되어있습니다.

컴포넌트 사용 예제가 기본 사용과 다른 태그로의 사용을 명확하게 보여줍니다.

apps/web/src/app/create/Create.tsx (2)

147-149: GradientAnimatedText 컴포넌트가 적절하게 사용되었습니다.

기존 GradientAnimatedTitle을 대체하여 잘 구현되었습니다.


258-260: 구독 관련 설명이 명확합니다.

Label 컴포넌트의 description prop을 활용하여 구독 정보를 잘 전달하고 있습니다.

packages/ui/package.json (1)

94-97: GradientAnimatedText 컴포넌트 export가 적절하게 추가되었습니다.

기존 컴포넌트들의 export 패턴을 일관성 있게 따르고 있습니다.

Comment on lines 28 to 87
if (asChild) {
return (
<Slot ref={ref}>
<motion.div
className={`${styles.gradientTitleStyle} ${className}`}
initial={{
y: '35vh',
scale: 2,
x: '-50%',
left: '50%',
position: 'absolute',
}}
animate={{
y: 0,
scale: 1,
x: 0,
left: 'auto',
position: 'relative',
}}
transition={{
type: 'spring',
duration: 0.6,
bounce: 0.22,
}}
{...props}
>
{children}
</motion.div>
</Slot>
);
}

return (
<motion.h1
ref={ref}
className={`${styles.gradientTitleStyle} ${className}`}
initial={{
y: '35vh',
scale: 2,
x: '-50%',
left: '50%',
position: 'absolute',
}}
animate={{
y: 0,
scale: 1,
x: 0,
left: 'auto',
position: 'relative',
}}
transition={{
type: 'spring',
duration: 0.6,
bounce: 0.22,
}}
{...props}
>
{children}
</motion.h1>
);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

애니메이션 코드 중복을 제거해주세요.

motion 설정이 Sloth1 렌더링 경로에서 중복되어 있습니다.

다음과 같이 리팩토링하는 것을 추천드립니다:

+const animationProps = {
+  initial: {
+    y: '35vh',
+    scale: 2,
+    x: '-50%',
+    left: '50%',
+    position: 'absolute',
+  },
+  animate: {
+    y: 0,
+    scale: 1,
+    x: 0,
+    left: 'auto',
+    position: 'relative',
+  },
+  transition: {
+    type: 'spring',
+    duration: 0.6,
+    bounce: 0.22,
+  },
+};

 export const GradientAnimatedText = forwardRef<
   HTMLHeadingElement,
   GradientAnimatedTextProps
 >(({ children, asChild, className = '', ...props }, ref) => {
   if (asChild) {
     return (
       <Slot ref={ref}>
         <motion.div
           className={`${styles.gradientTitleStyle} ${className}`}
-          initial={{
-            y: '35vh',
-            scale: 2,
-            x: '-50%',
-            left: '50%',
-            position: 'absolute',
-          }}
-          animate={{
-            y: 0,
-            scale: 1,
-            x: 0,
-            left: 'auto',
-            position: 'relative',
-          }}
-          transition={{
-            type: 'spring',
-            duration: 0.6,
-            bounce: 0.22,
-          }}
+          {...animationProps}
           {...props}
         >
           {children}
         </motion.div>
       </Slot>
     );
   }

   return (
     <motion.h1
       ref={ref}
       className={`${styles.gradientTitleStyle} ${className}`}
-      initial={{
-        y: '35vh',
-        scale: 2,
-        x: '-50%',
-        left: '50%',
-        position: 'absolute',
-      }}
-      animate={{
-        y: 0,
-        scale: 1,
-        x: 0,
-        left: 'auto',
-        position: 'relative',
-      }}
-      transition={{
-        type: 'spring',
-        duration: 0.6,
-        bounce: 0.22,
-      }}
+      {...animationProps}
       {...props}
     >
       {children}
     </motion.h1>
   );
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (asChild) {
return (
<Slot ref={ref}>
<motion.div
className={`${styles.gradientTitleStyle} ${className}`}
initial={{
y: '35vh',
scale: 2,
x: '-50%',
left: '50%',
position: 'absolute',
}}
animate={{
y: 0,
scale: 1,
x: 0,
left: 'auto',
position: 'relative',
}}
transition={{
type: 'spring',
duration: 0.6,
bounce: 0.22,
}}
{...props}
>
{children}
</motion.div>
</Slot>
);
}
return (
<motion.h1
ref={ref}
className={`${styles.gradientTitleStyle} ${className}`}
initial={{
y: '35vh',
scale: 2,
x: '-50%',
left: '50%',
position: 'absolute',
}}
animate={{
y: 0,
scale: 1,
x: 0,
left: 'auto',
position: 'relative',
}}
transition={{
type: 'spring',
duration: 0.6,
bounce: 0.22,
}}
{...props}
>
{children}
</motion.h1>
);
const animationProps = {
initial: {
y: '35vh',
scale: 2,
x: '-50%',
left: '50%',
position: 'absolute',
},
animate: {
y: 0,
scale: 1,
x: 0,
left: 'auto',
position: 'relative',
},
transition: {
type: 'spring',
duration: 0.6,
bounce: 0.22,
},
};
export const GradientAnimatedText = forwardRef<
HTMLHeadingElement,
GradientAnimatedTextProps
>(({ children, asChild, className = '', ...props }, ref) => {
if (asChild) {
return (
<Slot ref={ref}>
<motion.div
className={`${styles.gradientTitleStyle} ${className}`}
{...animationProps}
{...props}
>
{children}
</motion.div>
</Slot>
);
}
return (
<motion.h1
ref={ref}
className={`${styles.gradientTitleStyle} ${className}`}
{...animationProps}
{...props}
>
{children}
</motion.h1>
);
});

Copy link
Member

@kongnayeon kongnayeon left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~!

@minseong0324 minseong0324 merged commit 0e3d4a9 into develop Feb 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants