fix(fe): 커스텀 폰트 크기 토큰이 cn()에서 삭제돼 텍스트가 커지던 회귀 해결#125
Merged
Conversation
styles.css @theme의 --text-caption/label/body는 값이 있는 커스텀 font-size 토큰인데, 기본 tailwind-merge는 이를 폰트 크기로 인식하지 못해 텍스트 색상으로 분류한다. 그래서 cn()에서 text-foreground·text-muted-foreground 같은 색상과 함께 쓰면 서로 충돌한다고 보고 크기 토큰을 삭제해, 해당 요소가 폰트 크기 클래스를 잃고 상속 크기(16px 등)로 부풀어 올랐다. 바텀 탭 라벨, TagChip, EmptyState 제목 등 cn()에 색상과 함께 태우는 곳 전반에서 발생했다. extendTailwindMerge로 세 토큰을 font-size 그룹에 명시 등록해, 색상과 공존해도 삭제되지 않고 다른 폰트 크기와는 올바르게 병합되도록 한다. styles.css의 --text-* 목록과 동기화가 필요하다. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
seongbin9786
marked this pull request as ready for review
July 20, 2026 12:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
바텀 탭 라벨을 비롯한 여러 화면의 텍스트가 의도한 크기보다 커져 보이던 문제를 해결한다. 실제로 바텀 탭 라벨은 11px가 아니라 상속값 16px로 렌더되고 있었다.
원인
#117에서text-[11px]같은 임의값을styles.css @theme의 커스텀font-size토큰(--text-caption/label/body)으로 바꿨는데,cn()이 쓰는 기본tailwind-merge는 이 토큰들을 폰트 크기로 인식하지 못한다. 값 없는text-*패턴이라 텍스트 색상으로 분류해 버린다.그 결과
cn()에서text-foreground·text-muted-foreground같은 색상 클래스와 함께 쓰면 서로 충돌한다고 보고 크기 토큰을 삭제한다. 크기 클래스를 잃은 요소는 상속 크기(대개 16px)로 부풀어 오른다.구버전
text-[11px]은 임의 길이값이라tailwind-merge가 폰트 크기로 올바르게 인식해 삭제되지 않았다. 즉#117의 "렌더가 이전과 픽셀 동일" 전제는cn()으로 색상과 함께 쓰는 경우 성립하지 않았다.확인된 영향 지점(
cn()으로 색상과 병합되는 곳):StackTabBar) — 모든 화면TagChip(관계 태그, size 변형이text-label/caption, surface 변형이 색상) — 사람·프로필·타임라인·설정 전반EmptyState제목(text-body+ 색상) — 빈 상태 화면 전반플레인 문자열(
className="...",cn()미경유)로 쓴 곳은 색상과 병합되지 않아 영향이 없다.해결
cn의tailwind-merge를extendTailwindMerge로 확장해 세 토큰을font-size그룹에 명시 등록한다. 이러면 색상과 공존해도 삭제되지 않고, 다른 폰트 크기와는 정상적으로 병합(뒤가 이김)된다. 손댄 파일은frontend/src/lib/utils.ts한 개다.styles.css의--text-*목록과 토큰 이름을 동기화해야 하며, 그 취지는 코드 주석으로 남겼다.검증
utils.ts의cn을 import해 확인:cn("text-caption font-bold text-muted-foreground")→text-caption유지cn("text-label font-bold text-foreground")→text-label유지cn("text-body font-extrabold text-foreground")→text-body유지cn("text-caption text-sm")→text-sm(폰트 크기끼리 뒤가 이김)pnpm run typecheck통과eslint src/lib/utils.ts통과