refactor(theme): replace brand-color ThemeProvider with light/dark mode toggle#282
Conversation
🦋 Changeset detectedLatest commit: c9c5497 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
| interface ThemeProviderProps { | ||
| children: React.ReactNode; | ||
| theme?: ThemeColor; | ||
| children?: React.ReactNode; |
There was a problem hiding this comment.
여기 children optional로 바꾼 이유가 뭐예용?
|
|
||
| - `ThemeProvider` now applies themes via `data-theme` attribute instead of `assignInlineVars` | ||
| - `theme` prop changed from brand-color objects to `'light' | 'dark'` string union | ||
| - `ColorTheme` type is now exported from `@sipe-team/tokens` |
There was a problem hiding this comment.
실제 export 되는건 ThemeMode 아닌가요??
| '700': `${fontSize[32]}px`, | ||
| '800': `${fontSize[36]}px`, | ||
| '900': `${fontSize[48]}px`, | ||
| '050': cssVar('typography-font-size-12'), |
There was a problem hiding this comment.
flow를 잘 이해 못 한거 같은데 여기서 var(--변수) 참조를 선언하고 값은 어디서 가져오는건가요?
There was a problem hiding this comment.
SD가 빌드할때 뱉어낸 dist안에 css(primitive.css, semantic-dark.css)에서 가져옵니다! themes.css.ts 에서는 실제 값을 가지진 않고 매핑만 해용
| mode: 'dark', | ||
| theme: '4th', | ||
| color: darkColor, | ||
| }); |
There was a problem hiding this comment.
혹시 data-theme="light" 는 없는데 이유가 있을까요..?
ThemeMode 에는 light | dark 가 정의되어 있는데. dark 만 있어서요.
게다가 root 도 darkColor 로 fallback 되는데.
아니면 다음에 진행할 거라면,
ThemeMode 에서 light 는 삭제하거나 임시 주석을 넣어주는 게 좋을 것 같습니다.
There was a problem hiding this comment.
SIDE가 라이트 모드를 현재 지원하고 있지 않아서 없습니다.
주석 추가해두었습니다! chore: add TODO comments for pending light mode
| "Write", | ||
| "Read" | ||
| "Read", | ||
| "Read(./packages/tokens/dist/*)" |
There was a problem hiding this comment.
이거 dist/** 로 해야하지 않을까요...?
dist/* 면 1 depth 만 매칭되는데요.
There was a problem hiding this comment.
|
@G-hoon @Yeom-JinHo 리뷰 코멘트 리마인드 드립니당 |
Summary
기수별 브랜드 컬러 기반의 ThemeProvider를
data-theme속성을 활용한 라이트/다크 모드 토글 방식으로 전환하고, 디자인 토큰 값의 SSOT를tokens/tokens.json→ Style Dictionary 파이프라인으로 일원화했습니다.Changes
주요 변경
assignInlineVars기반에서data-theme속성 기반으로 변경했습니다.contract.css.ts)의 color/spacing/radius 구조를 semantic 토큰 계층으로 수정했습니다.themes.css.ts에서 JS 상수를 시멘틱 토큰 참조로 교체했습니다.mapVars유틸 함수/테스트코드 작성했습니다.기타
@sipe-team/theme에서@vanilla-extract/dynamic미사용 의존성 제거했습니다.