Conversation
Figma 디자인 기반 Button 컴포넌트 추가 - color variants: primary, secondary, tertiary - Radix UI Slot 패턴 지원 (asChild prop) - disabled 상태에서 hover 효과 제거 - React 19 네이티브 ref 지원 Co-Authored-By: Claude <noreply@anthropic.com>
- 모든 color variants 예시 (primary, secondary, tertiary) - disabled 상태 예시 - Figma 디자인의 2버튼 레이아웃 구현 - 전체 너비 버튼 예시 Co-Authored-By: Claude <noreply@anthropic.com>
Summary of ChangesHello @RookieAND, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 애플리케이션에 새로운 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
안녕하세요. Button 컴포넌트 추가 PR 리뷰를 맡게 되었습니다. 전반적으로 컴포넌트 구조와 cva를 활용한 변형 처리가 깔끔하게 잘 작성되었습니다. 데모 페이지도 다양한 케이스를 포함하고 있어 컴포넌트의 사용법을 이해하기 쉽습니다.
몇 가지 개선점을 제안드립니다.
ref전달: 현재ref를 props로 직접 받고 있는데, 이는 React 19 이전 버전과 호환성 문제가 발생할 수 있습니다.React.forwardRef를 사용하도록 수정하여 하위 호환성을 보장하고 더 안정적인 컴포넌트로 만드는 것을 제안했습니다.- 데모 페이지 개선:
asChildprop의 실제 사용 예시가 데모 페이지에 없어 추가하는 것을 제안했습니다.next/link와 함께 사용하는 예시를 추가하면 이 prop의 유용성을 더 잘 보여줄 수 있을 것입니다.
작성자님께서 질문주신 내용에 대한 제 의견은 다음과 같습니다.
colorvariant 네이밍:primary,secondary,tertiary는 역할에 따라 버튼을 구분하는 매우 일반적이고 좋은 네이밍 컨벤션이라고 생각합니다. Figma 디자인의 의도와도 잘 맞는 것 같습니다.disabled상태opacity:0.5는 비활성화 상태를 표현하는 데 일반적으로 사용되는 값입니다. 현재로서는 적절해 보이며, 만약 디자인 팀의 가이드가 있다면 그에 맞추거나, 추후에 시각적 피드백에 따라 미세 조정할 수 있겠습니다.asChildprop 사용 케이스: 위에서 제안드린 것처럼,next/link컴포넌트를Button으로 스타일링하는 것이 가장 흔하고 유용한 사용 사례입니다. 데모 페이지에 이 예시를 추가하면 좋을 것 같습니다.
수고 많으셨습니다!
| import type { ComponentProps } from 'react'; | ||
| import { twJoin } from 'tailwind-merge'; | ||
|
|
||
| const buttonVariants = cva( | ||
| [ | ||
| 'ygi:inline-flex ygi:items-center ygi:justify-center', | ||
| 'ygi:text-center ygi:whitespace-nowrap', | ||
| 'ygi:rounded-md ygi:px-xl ygi:py-sm', | ||
| 'ygi:cursor-pointer ygi:transition-colors', | ||
| 'ygi:disabled:cursor-not-allowed ygi:disabled:opacity-50', | ||
| 'ygi:heading-18-bd', | ||
| ], | ||
| { | ||
| variants: { | ||
| color: { | ||
| primary: [ | ||
| 'ygi:bg-palette-gray-800 ygi:text-palette-common-white', | ||
| 'ygi:hover:bg-palette-gray-900', | ||
| 'ygi:disabled:hover:bg-palette-gray-800', | ||
| ], | ||
| secondary: [ | ||
| 'ygi:bg-palette-gray-200 ygi:text-palette-gray-800', | ||
| 'ygi:hover:bg-palette-gray-300', | ||
| 'ygi:disabled:hover:bg-palette-gray-200', | ||
| ], | ||
| tertiary: [ | ||
| 'ygi:bg-palette-primary-500 ygi:text-palette-common-white', | ||
| 'ygi:hover:bg-palette-primary-700', | ||
| 'ygi:disabled:hover:bg-palette-primary-500', | ||
| ], | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| color: 'primary', | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| export type ButtonProps = ComponentProps<'button'> & | ||
| VariantProps<typeof buttonVariants> & { | ||
| asChild?: boolean; | ||
| }; | ||
|
|
||
| export const Button = ({ | ||
| color = 'primary', | ||
| disabled = false, | ||
| children, | ||
| asChild = false, | ||
| className, | ||
| ref, | ||
| ...props | ||
| }: ButtonProps) => { | ||
| const Component = asChild ? Slot : 'button'; | ||
|
|
||
| return ( | ||
| <Component | ||
| ref={ref} | ||
| disabled={disabled} | ||
| aria-disabled={disabled} | ||
| className={twJoin( | ||
| buttonVariants({ | ||
| color, | ||
| }), | ||
| className, | ||
| )} | ||
| {...props} | ||
| > | ||
| {children} | ||
| </Component> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
안녕하세요! Button 컴포넌트 구현 잘 보았습니다. ref 전달을 위해 forwardRef를 사용하는 것을 제안합니다.
PR 설명에서 React 19의 네이티브 ref 지원을 언급하셨지만, forwardRef를 사용하면 React 18 및 이전 버전과의 호환성을 보장할 수 있으며 React 19에서도 계속 지원될 예정입니다. 이렇게 하면 컴포넌트의 호환성과 안정성을 높일 수 있습니다.
이와 함께 ref 타입을 올바르게 추론하기 위해 ComponentProps 대신 ComponentPropsWithRef를 사용하고, 컴포넌트 디버깅 시 편의를 위해 displayName을 설정하는 것을 추천합니다.
import { forwardRef, type ComponentPropsWithRef } from 'react';
import { twJoin } from 'tailwind-merge';
const buttonVariants = cva(
[
'ygi:inline-flex ygi:items-center ygi:justify-center',
'ygi:text-center ygi:whitespace-nowrap',
'ygi:rounded-md ygi:px-xl ygi:py-sm',
'ygi:cursor-pointer ygi:transition-colors',
'ygi:disabled:cursor-not-allowed ygi:disabled:opacity-50',
'ygi:heading-18-bd',
],
{
variants: {
color: {
primary: [
'ygi:bg-palette-gray-800 ygi:text-palette-common-white',
'ygi:hover:bg-palette-gray-900',
'ygi:disabled:hover:bg-palette-gray-800',
],
secondary: [
'ygi:bg-palette-gray-200 ygi:text-palette-gray-800',
'ygi:hover:bg-palette-gray-300',
'ygi:disabled:hover:bg-palette-gray-200',
],
tertiary: [
'ygi:bg-palette-primary-500 ygi:text-palette-common-white',
'ygi:hover:bg-palette-primary-700',
'ygi:disabled:hover:bg-palette-primary-500',
],
},
},
defaultVariants: {
color: 'primary',
},
},
);
export type ButtonProps = ComponentPropsWithRef<'button'> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
};
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
(
{
color = 'primary',
disabled = false,
children,
asChild = false,
className,
...props
},
ref,
) => {
const Component = asChild ? Slot : 'button';
return (
<Component
ref={ref}
disabled={disabled}
aria-disabled={disabled}
className={twJoin(
buttonVariants({
color,
}),
className,
)}
{...props}
>
{children}
</Component>
);
},
);
Button.displayName = 'Button';
| <p className="ygi:body-14-rg ygi:text-gray-500"> | ||
| 전체 너비를 차지하는 버튼입니다. | ||
| </p> | ||
| </div> |
There was a problem hiding this comment.
데모 페이지에 asChild prop 사용 예제를 추가하면 컴포넌트의 활용법을 더 명확하게 보여줄 수 있을 것 같습니다. next/link를 Button으로 감싸는 예시를 추가하는 것을 고려해보세요. 페이지 상단에 import Link from 'next/link';를 추가하고, 아래와 같은 예제 코드를 추가할 수 있습니다:
{/* asChild example with Next.js Link */}
<div className="ygi:flex ygi:flex-col ygi:gap-sm">
<h2 className="ygi:heading-20-sb ygi:text-gray-900">
asChild Prop with Next.js Link
</h2>
<Button color="primary" asChild>
<Link href="/button">Link as a button</Link>
</Button>
<p className="ygi:body-14-rg ygi:text-gray-500">
`asChild` prop을 사용하여 `next/link`와 같은 다른 컴포넌트를 버튼으로 래핑할 수 있습니다.
</p>
</div>There was a problem hiding this comment.
경험 상 ? 단순 링크 역할이지만 스타일은 버튼과 같은 스타일로 처리해야하는 케이스가 자주 있었어
* feat: Button 컴포넌트 구현 Figma 디자인 기반 Button 컴포넌트 추가 - color variants: primary, secondary, tertiary - Radix UI Slot 패턴 지원 (asChild prop) - disabled 상태에서 hover 효과 제거 - React 19 네이티브 ref 지원 Co-Authored-By: Claude <noreply@anthropic.com> * feat: Button 컴포넌트 예시 페이지 추가 - 모든 color variants 예시 (primary, secondary, tertiary) - disabled 상태 예시 - Figma 디자인의 2버튼 레이아웃 구현 - 전체 너비 버튼 예시 Co-Authored-By: Claude <noreply@anthropic.com> * chore: button 디렉터리 네이밍 수정 * refactor: Button 디렉터리명을 camelCase로 변경 * chore: Chip 과 동일하게 ButtonProps 타입도 export --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: 위영민 <youngminieo1005@gmail.com>
## 1.0.0-beta.1 (2026-02-16) ### Features * [#70](#70) ([#72](#72)) ([b676e0e](b676e0e)) * [QA] 모임 생성 완료, 결과페이지 페이지 UI 개선 ([#66](#66)) ([f10225d](f10225d)) * [QA] 서비스 전체 배경색 및 Layout Root 그림자 효과 적용 ([#59](#59)) ([384b56f](384b56f)) * api client 모듈 생성 ([#37](#37)) ([a37b0a9](a37b0a9)), closes [#38](#38) [#39](#39) [#40](#40) [#41](#41) * Button 컴포넌트 추가 ([#11](#11)) ([83b7607](83b7607)) * Chip Component 추가 ([#9](#9)) ([e9d8b8f](e9d8b8f)) * Color theme 초기화 ([#2](#2)) ([97f1dcc](97f1dcc)) * DotsLoader 컴포넌트 추가 ([#48](#48)) ([cfe4582](cfe4582)), closes [#49](#49) * GA4 이벤트 트래킹 통합 ([#70](#70)) ([0c1b9fa](0c1b9fa)) * GTM(Google Tag Manager) 통합을 위한 Analytics 컴포넌트 추가 ([#57](#57)) ([87a6ded](87a6ded)) * IconBase 컴포넌트 및 아이콘 컴포넌트들 구축 ([#13](#13)) ([8557b75](8557b75)), closes [#FFCD00](https://github.com/Nexters/yogieat/issues/FFCD00) [#FFAD00](https://github.com/Nexters/yogieat/issues/FFAD00) [#15](#15) [#ff5a3c](https://github.com/Nexters/yogieat/issues/ff5a3c) * InputField 컴포넌트 추가 ([#16](#16)) ([99b8aa2](99b8aa2)) * Landing / Opinion Form 페이지 분리 ([#61](#61)) ([0f11e71](0f11e71)) * Layout 컴포넌트 추가 ([#10](#10)) ([9efce6f](9efce6f)) * Semantic Color Token 추가 ([#19](#19)) ([fcaedaf](fcaedaf)) * Spacing utility 클래스 초기화 ([#8](#8)) ([2e38d7a](2e38d7a)) * Tag 컴포넌트 추가 ([#20](#20)) ([f69dd05](f69dd05)) * Toast 컴포넌트 추가 ([#21](#21)) ([76e84b0](76e84b0)) * 모임 생성 퍼널 Step 1 (인원 선택) 구현 ([#23](#23)) ([7fc01a1](7fc01a1)), closes [#24](#24) [#1f2933](https://github.com/Nexters/yogieat/issues/1f2933) [#ff5a3c](https://github.com/Nexters/yogieat/issues/ff5a3c) [#25](#25) [#26](#26) [#27](#27) [#28](#28) [#29](#29) [#30](#30) [#31](#31) [#32](#32) [#34](#34) * 프로젝트 기초 세팅 진행 ([aa0ec20](aa0ec20)) * 프로젝트 폴더 구조 반영 ([e54962d](e54962d)) ### Bug Fixes * 1순위를 1개라도 선택했다면 바로 CTA 가 활성화 되도록 수정 ([#60](#60)) ([e5758b4](e5758b4)) * 1차 MVP 배포 이전 최종 QA 항목 반영 ([#58](#58)) ([6574231](6574231)) * Button/Chip type 속성 추가 및 의견 수렴 UX 개선 ([#50](#50)) ([7e86e4a](7e86e4a)), closes [#51](#51) [#52](#52) [#53](#53) [#54](#54) [#55](#55) [#56](#56) * cat 에서 echo 로 env.production 파일을 생성하도록 수정 ([f15307d](f15307d)) * CI/CD health check 타이밍 개선 및 수동 배포 기능 추가 ([54fd2b8](54fd2b8)) * Docker build-args로 환경 변수 전달 방식 변경 ([#77](#77)) ([e5fa0b9](e5fa0b9)) * Docker 이미지 강제 pull 및 컨테이너 재생성 ([#79](#79)) ([c253ec1](c253ec1)) * Health check 전략 개선 및 curl 기반으로 변경 ([765d3da](765d3da)) * nginx http2 deprecated 경고 해결 ([2fd9c75](2fd9c75)) * PendingView 내에서 ShareButton 을 렌더링 하지 않도록 수정 ([7bc3e12](7bc3e12)) * 결과 페이지 맛집 이미지 기본 placeholder, 공유하기 toast 미노출 ([#68](#68)) ([3c80844](3c80844)) * 동시 배포 방지를 위한 concurrency 설정 추가 ([e9bfd52](e9bfd52)) * 모임 생성 퍼널 필드 상태 초기화 버그 수정 ([#64](#64)) ([3934066](3934066)), closes [#65](#65) * 모임 생성 폼 필드명 변경 (meetingDate → scheduledDate, location → region) ([#35](#35)) ([e90beed](e90beed)) * 배포 워크플로우에 GA4 환경 변수 추가 ([#73](#73)) ([835ae1f](835ae1f)) * 의견 수렴 페이지 내 UI 수정 및 인터렉션 개선 ([#36](#36)) ([a74f7da](a74f7da)) * 의견 수합 Form Capacity 폴링 제거 및 ErrorCode 타입 시스템 추가 ([#67](#67)) ([d55dba1](d55dba1)) * 인원 수 선택 Grid 및 의견 수렴 QA 수정 사항 반영 ([f01626e](f01626e)) * 테스트 용으로 추가했던 페이지 제거 및 icons 폴더 추가 ([4116025](4116025)) ### Code Refactoring * Button 컴포넌트 스펙을 Figma 명세에 맞춰 수정 ([#14](#14)) ([2e27f17](2e27f17)) ### Build System * Docker 빌드 시 NEXT_PUBLIC 환경변수 주입 프로세스 추가 ([#47](#47)) ([88ba163](88ba163)) ### Documentation * 프로젝트 개발 가이드 문서 추가 ([#84](#84)) ([4313145](4313145))
## 1.0.0 (2026-02-16) ### Features * [#70](#70) ([#72](#72)) ([b676e0e](b676e0e)) * [QA] 모임 생성 완료, 결과페이지 페이지 UI 개선 ([#66](#66)) ([f10225d](f10225d)) * [QA] 서비스 전체 배경색 및 Layout Root 그림자 효과 적용 ([#59](#59)) ([384b56f](384b56f)) * analytics 개선 및 네이버 서치 어드바이저 등록 ([#88](#88)) ([4372aa5](4372aa5)) * api client 모듈 생성 ([#37](#37)) ([a37b0a9](a37b0a9)), closes [#38](#38) [#39](#39) [#40](#40) [#41](#41) * Button 컴포넌트 추가 ([#11](#11)) ([83b7607](83b7607)) * Chip Component 추가 ([#9](#9)) ([e9d8b8f](e9d8b8f)) * Color theme 초기화 ([#2](#2)) ([97f1dcc](97f1dcc)) * DotsLoader 컴포넌트 추가 ([#48](#48)) ([cfe4582](cfe4582)), closes [#49](#49) * GA4 이벤트 트래킹 통합 ([#70](#70)) ([0c1b9fa](0c1b9fa)) * GTM(Google Tag Manager) 통합을 위한 Analytics 컴포넌트 추가 ([#57](#57)) ([87a6ded](87a6ded)) * IconBase 컴포넌트 및 아이콘 컴포넌트들 구축 ([#13](#13)) ([8557b75](8557b75)), closes [#FFCD00](https://github.com/Nexters/yogieat/issues/FFCD00) [#FFAD00](https://github.com/Nexters/yogieat/issues/FFAD00) [#15](#15) [#ff5a3c](https://github.com/Nexters/yogieat/issues/ff5a3c) * InputField 컴포넌트 추가 ([#16](#16)) ([99b8aa2](99b8aa2)) * Landing / Opinion Form 페이지 분리 ([#61](#61)) ([0f11e71](0f11e71)) * Layout 컴포넌트 추가 ([#10](#10)) ([9efce6f](9efce6f)) * Semantic Color Token 추가 ([#19](#19)) ([fcaedaf](fcaedaf)) * Spacing utility 클래스 초기화 ([#8](#8)) ([2e38d7a](2e38d7a)) * Tag 컴포넌트 추가 ([#20](#20)) ([f69dd05](f69dd05)) * Toast 컴포넌트 추가 ([#21](#21)) ([76e84b0](76e84b0)) * 모임 생성 완료 페이지 UI 리뉴얼 ([#89](#89)) ([17a3fc1](17a3fc1)) * 모임 생성 퍼널 Step 1 (인원 선택) 구현 ([#23](#23)) ([7fc01a1](7fc01a1)), closes [#24](#24) [#1f2933](https://github.com/Nexters/yogieat/issues/1f2933) [#ff5a3c](https://github.com/Nexters/yogieat/issues/ff5a3c) [#25](#25) [#26](#26) [#27](#27) [#28](#28) [#29](#29) [#30](#30) [#31](#31) [#32](#32) [#34](#34) * 프로젝트 기초 세팅 진행 ([aa0ec20](aa0ec20)) * 프로젝트 폴더 구조 반영 ([e54962d](e54962d)) ### Bug Fixes * 1순위를 1개라도 선택했다면 바로 CTA 가 활성화 되도록 수정 ([#60](#60)) ([e5758b4](e5758b4)) * 1차 MVP 배포 이전 최종 QA 항목 반영 ([#58](#58)) ([6574231](6574231)) * Button/Chip type 속성 추가 및 의견 수렴 UX 개선 ([#50](#50)) ([7e86e4a](7e86e4a)), closes [#51](#51) [#52](#52) [#53](#53) [#54](#54) [#55](#55) [#56](#56) * cat 에서 echo 로 env.production 파일을 생성하도록 수정 ([f15307d](f15307d)) * CI/CD health check 타이밍 개선 및 수동 배포 기능 추가 ([54fd2b8](54fd2b8)) * Docker build-args로 환경 변수 전달 방식 변경 ([#77](#77)) ([e5fa0b9](e5fa0b9)) * Docker 이미지 강제 pull 및 컨테이너 재생성 ([#79](#79)) ([c253ec1](c253ec1)) * Health check 전략 개선 및 curl 기반으로 변경 ([765d3da](765d3da)) * nginx http2 deprecated 경고 해결 ([2fd9c75](2fd9c75)) * PendingView 내에서 ShareButton 을 렌더링 하지 않도록 수정 ([7bc3e12](7bc3e12)) * 결과 페이지 맛집 이미지 기본 placeholder, 공유하기 toast 미노출 ([#68](#68)) ([3c80844](3c80844)) * 동시 배포 방지를 위한 concurrency 설정 추가 ([e9bfd52](e9bfd52)) * 모임 생성 퍼널 필드 상태 초기화 버그 수정 ([#64](#64)) ([3934066](3934066)), closes [#65](#65) * 모임 생성 폼 필드명 변경 (meetingDate → scheduledDate, location → region) ([#35](#35)) ([e90beed](e90beed)) * 배포 워크플로우에 GA4 환경 변수 추가 ([#73](#73)) ([835ae1f](835ae1f)) * 의견 수렴 페이지 내 UI 수정 및 인터렉션 개선 ([#36](#36)) ([a74f7da](a74f7da)) * 의견 수합 Form Capacity 폴링 제거 및 ErrorCode 타입 시스템 추가 ([#67](#67)) ([d55dba1](d55dba1)) * 인원 수 선택 Grid 및 의견 수렴 QA 수정 사항 반영 ([f01626e](f01626e)) * 테스트 용으로 추가했던 페이지 제거 및 icons 폴더 추가 ([4116025](4116025)) ### Code Refactoring * Button 컴포넌트 스펙을 Figma 명세에 맞춰 수정 ([#14](#14)) ([2e27f17](2e27f17)) ### Build System * Docker 빌드 시 NEXT_PUBLIC 환경변수 주입 프로세스 추가 ([#47](#47)) ([88ba163](88ba163)) ### Documentation * 프로젝트 개발 가이드 문서 추가 ([#84](#84)) ([4313145](4313145))
🎯 PR 제목
Button 컴포넌트 구현 및 예시 페이지 추가
📑 작업 상세 내역
colorvariants: primary (gray-800), secondary (gray-200), tertiary (primary-500)asChildprop)disabled:hover스타일 추가)typeattribute와 충돌 방지를 위해colorprop 사용/button)🙏 리뷰 요청 사항
asChildprop을 사용한 Slot 패턴의 실제 사용 케이스 검토 부탁드립니다📃 참고 자료
🖼️ 작업 결과물
/buttonsrc/components/Button/Button.tsx