Skip to content

[refactor] Button 컴포넌트 확장성 개선#1392

Open
seongwon030 wants to merge 2 commits intodevelop-fefrom
refactor/#1391-button-extensibility-MOA-788
Open

[refactor] Button 컴포넌트 확장성 개선#1392
seongwon030 wants to merge 2 commits intodevelop-fefrom
refactor/#1391-button-extensibility-MOA-788

Conversation

@seongwon030
Copy link
Copy Markdown
Member

@seongwon030 seongwon030 commented Apr 7, 2026

#️⃣연관된 이슈

ex) #1391

📝작업 내용

  • ButtonHTMLAttributes<HTMLButtonElement> 확장으로 type, aria-*, data-* 등 모든 HTML 버튼 속성 자동 지원
  • 하드코딩 색상(#3a3a3a, #ffffff)을 테마 시스템(theme.colors)으로 교체
  • styled-components transient props($animated, $width) 적용으로 DOM 전달 경고 제거

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

  • 새 기능

    • Button이 모든 기본 HTML 버튼 속성을 지원하도록 확장되었습니다.
    • widthanimated 속성 추가로 너비 커스터마이징과 호버/클릭 애니메이션 가능.
    • 기본 typebutton으로 설정됨.
  • 개선 사항

    • 비활성화 시 호버/활성 효과 비적용 및 비활성 시 테마 그레이로 시각 일관성 향상.
    • 애니메이션이 크기 스케일링으로 단순화되어 동작이 명확해짐.
  • 문서

    • Button 컴포넌트 사용법 및 예시 문서 추가.

- ButtonHTMLAttributes 확장으로 type, aria-*, data-* 등 자동 지원
- 하드코딩 색상을 테마 시스템(theme.colors)으로 교체
- transient props($animated, $width) 적용으로 DOM 전달 경고 제거
@seongwon030 seongwon030 self-assigned this Apr 7, 2026
@seongwon030 seongwon030 added 🔨 Refactor 코드 리팩토링 💻 FE Frontend labels Apr 7, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moadong Ready Ready Preview, Comment Apr 7, 2026 6:47am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3108e23-4399-4847-9caf-7cece8b382ca

📥 Commits

Reviewing files that changed from the base of the PR and between c65b44d and 6bebe4b.

📒 Files selected for processing (1)
  • frontend/src/components/common/Button/Button.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/common/Button/Button.tsx

Walkthrough

Button 문서가 새로 추가되고 Button 구현이 React의 기본 HTML 버튼 속성을 상속하도록 리팩토링되며 트랜지언트 스타일 props와 rest 스프레딩으로 네이티브 props 전달 방식이 변경되었습니다. 스타일과 애니메이션, 비활성 상태 처리도 조정되었습니다.

변경 사항

Cohort / File(s) Summary
문서 추가
frontend/docs/features/components/Button.md
공유 Button 컴포넌트 문서 추가: 네이티브 버튼 속성 호환, widthanimated props 설명, 사용 예시 및 테마 스타일링 토큰/레이아웃 값 문서화.
컴포넌트 구현 리팩토링
frontend/src/components/common/Button/Button.tsx
ButtonPropsReact.ButtonHTMLAttributes<HTMLButtonElement>를 확장하도록 변경. children, type, onClick, disabled, className 등 명시적 선언 제거. 트랜지언트 스타일 props ($animated, $width) 사용, hover/active 스타일은 비활성화 상태 제외 조건으로 적용, pulse 애니메이션은 스케일만 변경. type 기본값 'button', 나머지 네이티브 props는 ...rest로 전달.

Sequence Diagram(s)

(해당 변경은 문서 추가 및 컴포넌트 내부 리팩토링으로, 복잡한 다중 컴포넌트 시퀀스 흐름 시각화 필요 없음.)

예상 코드 검토 난이도

🎯 3 (중간) | ⏱️ ~20분

관련 가능성이 있는 PR

제안된 검토자

  • lepitaaar
  • oesnuj
  • suhyun113
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 Button 컴포넌트의 확장성 개선이라는 주요 변경사항을 명확하게 요약하고 있으며, 변경된 핵심 내용과 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/#1391-button-extensibility-MOA-788

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🎨 UI 변경사항을 확인해주세요

변경된 스토리를 Chromatic에서 확인해주세요.

구분 링크
🔍 변경사항 리뷰 https://www.chromatic.com/build?appId=67904e61c16daa99a63b44a7&number=153
📖 Storybook https://67904e61c16daa99a63b44a7-mymbrryxga.chromatic.com/

7개 스토리 변경 · 전체 56개 스토리 · 22개 컴포넌트

Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/components/common/Button/Button.tsx`:
- Around line 51-57: The Button component currently relies on the browser
default type (which is "submit") causing unintended form submits; update the
Button component (and ButtonProps if needed) to default the type prop to
"button" and ensure it is passed into <StyledButton $animated={animated}
$width={width} {...rest}> (e.g., set type = "button" in the destructured props
or merge a defaulted type into the spread) so callers can still override with
type="submit" when desired; reference the Button component, ButtonProps, and
StyledButton to locate and change the prop default.
- Around line 8-12: The pulse keyframes animation should be removed and replaced
by Framer Motion props inside the Button component's JSX: import motion from
'framer-motion' if not already, change the root element to motion.button, and
replace any CSS-based pulse/hover/active logic (the pulse symbol and the
previous hover/active styles) with whileHover={{ scale: 1.05 }} and whileTap={{
scale: 0.98 }} (adjust values to match existing visuals). Ensure you also remove
the keyframes declaration (pulse) and any CSS animation references so the
component uses only motion.button with whileHover/whileTap for consistent Framer
Motion behavior.
- Line 3: The file references the React namespace in the ButtonProps declaration
(extends React.ButtonHTMLAttributes<HTMLButtonElement>) but doesn't import
React, causing "Cannot find namespace 'React'"; fix by adding an explicit import
from 'react' and/or using a type-only import such as importing
ButtonHTMLAttributes (e.g. import React from 'react' or import type {
ButtonHTMLAttributes } from 'react') and update the ButtonProps declaration
accordingly so the React type is resolved (refer to the ButtonProps symbol and
its use of React.ButtonHTMLAttributes<HTMLButtonElement>).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c71a5bb1-431a-445f-9f7c-a430889f2a93

📥 Commits

Reviewing files that changed from the base of the PR and between a2dca15 and c65b44d.

📒 Files selected for processing (2)
  • frontend/docs/features/components/Button.md
  • frontend/src/components/common/Button/Button.tsx

폼 내부에서 의도치 않은 submit 방지
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant