Skip to content

feat: Button 공통 base 및 CTA/Body module variant 구현 - #10

Merged
hamxxn merged 12 commits into
developfrom
feat/issue-7
Aug 8, 2026
Merged

feat: Button 공통 base 및 CTA/Body module variant 구현#10
hamxxn merged 12 commits into
developfrom
feat/issue-7

Conversation

@hamxxn

@hamxxn hamxxn commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Button 프리미티브(Button), 화면 하단 CTA용 CTAButton(Single/Double 컴파운드), 선택 상태를 표시하는 Radio(primary/outline), 아이콘 전용 버튼 IconButton을 구현하고 각각 shared/ui/button, shared/ui/radio의 public API로 노출했다.

사용 방법

import { Button, CTAButton, IconButton } from "@/shared/ui/button";
import { Radio } from "@/shared/ui/radio";
import { CloseIcon } from "@/shared/ui/icons";

// 기본 버튼
<Button onClick={handleClick}>확인</Button>
<Button disabled>비활성</Button>
<Button isLoading>로딩 중</Button>

// 화면 하단 고정 CTA (fixed=true가 기본값, safe-area 패딩 자동 적용)
<CTAButton background="white">
  <CTAButton.Single>다음</CTAButton.Single>
</CTAButton>

<CTAButton fixed={false}>
  <CTAButton.Double
    leftButton={<Button>취소</Button>}
    rightButton={<Button>확인</Button>}
  />
</CTAButton>

// 선택 인디케이터
<Radio variant="primary" isSelected={selected} onClick={() => setSelected(true)} />

<Radio variant="outline" isSelected={selected} onClick={() => setSelected(true)} />

// 아이콘 버튼 (배경/variant 없음, className/iconClassName으로 버튼·아이콘 크기 독립 제어)
<IconButton icon={CloseIcon} aria-label="닫기" className="p-2" />

Related Issues

PR Point (To Reviewer)

  • 색상/타이포 디자인 토큰이 아직 확정되지 않아 시각 스타일은 Tailwind 유틸리티로 최소 구현했습니다. ButtonColorprimary/tertiary, ButtonSizelarge/medium까지 추가됐고, 추후 필요에 따라 계속 확장될 예정입니다.
  • Social Button은 별도 컴포넌트 없이 Button + className 커스텀으로 충분함을 구조로 남겼습니다 (social 폴더 없음).
  • ButtonRadio를 같은 폴더에 두지 않고 shared/ui/button / shared/ui/radio로 분리했습니다. 버튼은 액션 트리거, 라디오는 그룹 내 선택 상태 토글이라 상호작용 모델이 다르고, 실제로도 테마 토큰(BUTTON_* vs RADIO_*)을 전혀 공유하지 않아서 프리미티브 단위로 폴더를 나누는 기존 컨벤션을 그대로 따랐습니다.
  • 이슈 #7의 ButtonBodyModule(선택 인디케이터) 요구는 Radio로 대체 구현했고, 이슈 본문도 함께 갱신했습니다.
  • IconButtonshared/ui/button/icon-button/에 뒀지만 Button을 합성하지 않습니다. CTAButtonButtoncolor/size variant 스타일이 그대로 필요해서 합성하지만, IconButton은 배경·variant가 아예 없어서(shared/ui/icons의 아이콘을 감싸기만 함) Button을 합성하면 오히려 원치 않는 배경/패딩이 딸려옵니다. Radiobutton/ 밖에서 Button을 합성하지 않고 독립 프리미티브로 존재하는 것과 같은 이유로, IconButtonbutton/ 폴더 안에서 Button과 독립적인 프리미티브로 뒀습니다. shared/ui/icons/에 두는 방안도 검토했으나, 그 폴더는 pnpm generate:icons가 매번 통째로 지우고 재생성하는 codegen 산출물 전용이라(ADR 0001) 손으로 짠 컴포넌트를 둘 수 없습니다.
  • IconButtonaria-label을 필수 prop으로 타입에서 강제하고, 내부 아이콘에는 aria-hidden="true"를 자동으로 붙여 접근성 이름이 중복 노출되지 않도록 했습니다.

리뷰 반영 내역

  • text-gray-8text-gray-80 오타 수정
  • BUTTON_BASEflex 추가 (items-center/justify-center가 실제로 동작하지 않던 문제 수정, 아이콘 추가 시 센터링 깨짐 방지)
  • DoubleCTAButton에 기본 gap-[1.6rem] 추가 (두 버튼이 붙어 렌더링되던 문제 수정)
  • 로딩 중(isLoading)에는 버튼이 기능적으로만 비활성화되고, 시각적인 disabled 스타일(BUTTON_DISABLED)은 적용하지 않도록 변경
  • base/types/theme.ts + base/constants/variant.tsbase/theme.ts 하나로 통합 (폴더명과 실제 내용이 반대로 매칭되던 문제 정리)
  • tertiary 버튼 press(active) 상태 텍스트 색상(active:text-primary-700) 추가
  • IconButton 컴포넌트 추가 (shared/ui/button/icon-button/IconButton.tsx)

Screenshot

Button

스크린샷 2026-08-03 오후 5 28 01 스크린샷 2026-08-03 오후 5 28 06 스크린샷 2026-08-07 오전 8 37 00

Radio

스크린샷 2026-08-03 오후 5 26 02

ETC

  • Top button의 경우 상단 nav에서만 사용되기에 공통 컴포넌트로 구현하지 않았습니다.

@hamxxn hamxxn linked an issue Aug 3, 2026 that may be closed by this pull request
4 tasks
@hamxxn hamxxn self-assigned this Aug 3, 2026
@hamxxn
hamxxn requested review from sohxxny and thwjddlqslek August 3, 2026 08:30
Comment thread src/shared/ui/button/base/types/theme.ts Outdated
Comment thread src/shared/ui/button/cta-button/CTAButton.tsx Outdated
Comment thread src/shared/ui/button/base/constants/variant.ts Outdated

@thwjddlqslek thwjddlqslek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

수고하셨습니다~~

Comment thread src/shared/ui/button/base/constants/variant.ts Outdated
Comment thread src/shared/ui/button/base/types/theme.ts Outdated
Comment thread src/shared/ui/button/base/Button.tsx Outdated
Comment thread src/shared/ui/button/cta-button/CTAButton.tsx Outdated
Comment thread src/shared/ui/button/cta-button/CTAButton.tsx
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
aligner Ready Ready Preview Aug 7, 2026 10:34pm

@hamxxn
hamxxn merged commit e5b525e into develop Aug 8, 2026
4 checks passed
@sohxxny
sohxxny deleted the feat/issue-7 branch August 10, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Button 공통 base 및 CTA/Body module variant 구현

3 participants