Skip to content

refactor: sync token provider and refactor theme provider#192

Merged
froggy1014 merged 17 commits intorelease/v1from
refactor/sync-token-provider
Jul 19, 2025
Merged

refactor: sync token provider and refactor theme provider#192
froggy1014 merged 17 commits intorelease/v1from
refactor/sync-token-provider

Conversation

@froggy1014
Copy link
Copy Markdown
Contributor

@froggy1014 froggy1014 commented Jul 8, 2025

Changes

알단 File Changed 폭탄 죄송합니다. Token 폴더 구조바꿔서 많아진 것 같습니다..

Token

AS-IS TO-BE
image image
image image

피그마에서 정의된 Token에 대해서는 수정 및 추가했습니다.

Theme Provider

<ThemeProvider theme="4th">
  {children}
</ThemeProvider>

Screen Recording 2025-07-09 at 01 10 44

Button 예제

Nested Theme Interactive
image Screen Recording 2025-07-09 at 01 24 18

Visuals

Checklist

  • Have you written the functional specifications?
  • Have you written the test code?

Additional Discussion Points

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 8, 2025

⚠️ No Changeset found

Latest commit: 076839c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@sipe-team/package-name" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 8, 2025

Deploy Preview for side-design-system ready!

Name Link
🔨 Latest commit 076839c
🔍 Latest deploy log https://app.netlify.com/projects/side-design-system/deploys/687b7c26888592000885b5c0
😎 Deploy Preview https://deploy-preview-192--side-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 8, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
packages/theme/src/ThemeProvider.test.tsx 100.00% <100.00%> (ø)
packages/theme/src/ThemeProvider.tsx 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@froggy1014 froggy1014 added the enhancement New feature or request label Jul 8, 2025
Copy link
Copy Markdown
Member

@synuns synuns left a comment

Choose a reason for hiding this comment

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

컬러 토큰 관리

Comment on lines +133 to +161
export const themeColor = {
'1st': {
primary: '#01fe13',
secondary: '#01fe13',
background: '#000000',
text: color.white,
gradient: 'linear-gradient(45deg, #01fe13 0%, #000000 100%)',
},
'2nd': {
primary: '#03ff31',
secondary: '#06ffe3',
background: '#131518',
text: color.white,
gradient: 'linear-gradient(45deg, #03ff31 0%, #06ffe3 100%)',
},
'3rd': {
primary: '#00ffff',
secondary: '#00ff99',
background: '#0d0d0d',
text: color.white,
gradient: 'linear-gradient(45deg, #00FFFF 0%, #00FF99 100%)',
},
'4th': {
primary: '#f4a1a0',
secondary: '#f4a1a0',
background: '#0f1010',
text: color.white,
gradient: 'linear-gradient(45deg, #FF9595 0%, #FFE5B1 100%)',
},
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.

컬러 토큰에서 각 기수별로 관리가 되어야하는지에 대해서 논의해보면 좋을 것 같아요.

기수별 토큰이 디자인 시스템에서 관리되어야 한다면 책임이 너무 커지는 것 같아요.

일단 책임을 따로 두고 default 값만 현재 기수의 컬러 토큰으로두고,
프로바이더를 통해서 외부에서 주입받는 식으로 관리되는게 어떨까요?

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.

신원이 말도 동의하는데, 기수별로 토큰 값을 사용할거면 오브젝트 형태로 관리된 요소가 있으면 좋겠다는 생각도 있어!

Copy link
Copy Markdown
Contributor

@kimdaeyeob kimdaeyeob Jul 18, 2025

Choose a reason for hiding this comment

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

현재 단계에서는 단순하게 몇개의 테마만 지원하는데, 외부에서 주입받는것은 다소 과하지않을까라는 생각도 들기도해.
초기상태에는 명확한 파악을 할때 현재 구조가 도움이 될 것같아.

하지만 개선을 한다면 default 객체를 정의하고 prop을 기수를 '1st'와 같이 문자로 받는 대신 기수와 관련된 인터페이스를 정의해서 객체를 주입받도록 하는건 어떨까?

interface ThemColor {
    primary: string;
    secondary: string;
    ....
}
const defaultThemeColor: ThemColor = {
    primary: '#01fe13',
    secondary: '#01fe13'
    ....
} 
interface ThemeProviderProps {
  theme?: ThemColor; 
  children: ReactNode;
}
export const ThemeProvider = ({ theme = defaultThemeColor, children }: ThemeProviderProps) => {
   ...
}

Copy link
Copy Markdown
Contributor Author

@froggy1014 froggy1014 Jul 19, 2025

Choose a reason for hiding this comment

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

@jiji-hoon96 @synuns @kimdaeyeobbb

피드백을 보고 생각을 해봤는데,

1st ~ 4th 의 테마 색상들은 객체형태로 토큰에 남겨놓고 default로는 현재기수(4th) 가져오게끔 변경해봤어요.

theme 색상 자체를 외부에서 받을 수 있도록 ThemeColor라는 인터페이스를 도입 바꿔봤습니다. @kimdaeyeobbb

어떻게 생각하시나요.. 괜찮으면 바로 머지할게요 일단.

export interface ThemeColor {
  primary: string;
  secondary: string;
  background: string;
  text: string;
  gradient: string;
}

이 과정에서 data-theme 통한 기존에 정의된 테마를 가져오는게 아닌,
동적으로 색상이 주입될 수 있도록 내부적으로 자바스크립트로 CSS 변수를 직접 바꿀거같아요.

Object.entries(theme).forEach(([key, value]) => {
  element.style.setProperty(`--side-color-${key}`, value);
});

// AS-IS
<ThemeProvider theme="4th" />  // 오직 4가지 테마만

// TO-BE
<ThemeProvider theme={themeColor['1st']} />

<ThemeProvider theme={{
  primary: '#ff6b6b',     // 원하는 색상
  secondary: '#4ecdc4',   // 자유롭게 
  background: '#1a1a2e',  // 설정 가능
  text: '#ffffff',
  gradient: 'linear-gradient(45deg, #ff6b6b, #4ecdc4)'
}} />

스토리북 참고해주세요.

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.

오 이 방식 맘에 들어요

@jiji-hoon96
Copy link
Copy Markdown
Member

이거 처리해야 후속작업들 토큰 사용하는걸로 리팩토링 할 수 있어서 token 작업은 머지해도 괜찮을 것 같아요

Comment on lines +133 to +161
export const themeColor = {
'1st': {
primary: '#01fe13',
secondary: '#01fe13',
background: '#000000',
text: color.white,
gradient: 'linear-gradient(45deg, #01fe13 0%, #000000 100%)',
},
'2nd': {
primary: '#03ff31',
secondary: '#06ffe3',
background: '#131518',
text: color.white,
gradient: 'linear-gradient(45deg, #03ff31 0%, #06ffe3 100%)',
},
'3rd': {
primary: '#00ffff',
secondary: '#00ff99',
background: '#0d0d0d',
text: color.white,
gradient: 'linear-gradient(45deg, #00FFFF 0%, #00FF99 100%)',
},
'4th': {
primary: '#f4a1a0',
secondary: '#f4a1a0',
background: '#0f1010',
text: color.white,
gradient: 'linear-gradient(45deg, #FF9595 0%, #FFE5B1 100%)',
},
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.

신원이 말도 동의하는데, 기수별로 토큰 값을 사용할거면 오브젝트 형태로 관리된 요소가 있으면 좋겠다는 생각도 있어!

- Changed ThemeProvider to accept ThemeColor objects instead of string literals for themes.
- Updated related tests and stories to reflect the new theme structure.
- Improved theme handling by applying CSS variables directly from the ThemeColor object.
@froggy1014 froggy1014 merged commit 40ac71c into release/v1 Jul 19, 2025
10 checks passed
@froggy1014 froggy1014 deleted the refactor/sync-token-provider branch July 19, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants