Skip to content

Conversation

@dioo1461
Copy link
Contributor

@dioo1461 dioo1461 commented Jun 13, 2025

#️⃣ 연관된 이슈>

📝 작업 내용> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

  • ui 패키지에 Storybook 세팅했습니다.

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

Summary by CodeRabbit

  • New Features

    • Added Storybook integration for UI components, including development and build scripts.
    • Applied global theme and enhanced controls in Storybook for improved color and date property recognition.
    • Exposed the useCheckbox hook for external use.
  • Refactor

    • Simplified state initialization logic in the useGroup hook for improved reliability and maintainability.

@dioo1461 dioo1461 self-assigned this Jun 13, 2025
@dioo1461 dioo1461 added the 🖥️ FE Frontend label Jun 13, 2025
@dioo1461 dioo1461 requested a review from hamo-o as a code owner June 13, 2025 07:35
@coderabbitai
Copy link

coderabbitai bot commented Jun 13, 2025

Walkthrough

This update introduces Storybook configuration and preview files for the UI package, adds Storybook-related scripts to the package.json, exports the useCheckbox hook, and refactors the initialization logic in the useGroup hook for clarity and simplicity.

Changes

File(s) Change Summary
frontend/packages/ui/.storybook/main.ts, frontend/packages/ui/.storybook/preview.ts Added Storybook configuration and preview files, including Vite and Vanilla Extract integration and global parameters.
frontend/packages/ui/package.json Added "storybook" and "build-storybook" scripts for Storybook development and build.
frontend/packages/ui/src/index.ts Exported useCheckbox hook from the public API.
frontend/packages/ui/src/hooks/useGroup.ts Refactored initialization logic: removed useEffect, added initializeState helper, simplified reducer setup.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Storybook
    participant UI Components
    participant Hooks

    Developer->>Storybook: Start Storybook (npm run storybook)
    Storybook->>UI Components: Load stories with global parameters and theme
    UI Components->>Hooks: Import and use `useCheckbox`, `useGroup`
    Hooks-->>UI Components: Provide hook logic
    Storybook-->>Developer: Serve interactive UI with controls and visual testing
Loading

Possibly related PRs

Suggested reviewers

  • hamo-o

Poem

In the garden of code where stories bloom bright,
Storybook hops in, bringing components to light.
With hooks now exported and configs anew,
The UI grows stronger, more vivid in view.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

@dioo1461 dioo1461 changed the title [Feature] ui 패키지에 Storybook 세팅 [FE-Feat] ui 패키지에 Storybook 세팅 Jun 13, 2025
Copy link

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

🧹 Nitpick comments (4)
frontend/packages/ui/src/hooks/useGroup.ts (2)

38-40: Leverage initializeState helper in reducer
Centralizing initialization improves clarity; verify that cases like empty itemIds or defaultCheckedList behave as intended.


47-50: Extracted initializeState utility
Nice extraction. Consider adding a brief JSDoc comment to explain parameters and return shape for future maintainers.

frontend/packages/ui/.storybook/preview.ts (2)

1-3: Validate global CSS import and import ordering.

The bare import of @endolphin/theme/css applies your theme globally, which is good. Please confirm that Vite and Storybook are configured to resolve this path correctly and that the CSS is actually injected into your stories. Also consider aligning with your repo’s import-order lint rules—type-only imports (like import type { Preview } …) can be grouped separately below value imports.


5-14: Expand default Storybook parameters for better DX.

The controls.matchers setup is standard. To improve developer experience, you might want to include defaults for actions (e.g. auto-match on* handlers), or add background and viewport presets. Example diff:

 const preview: Preview = {
-  parameters: {
-    controls: {
-      matchers: {
-        color: /(background|color)$/i,
-        date: /Date$/i,
-      },
-    },
-  },
+  parameters: {
+    actions: { argTypesRegex: '^on.*' },
+    controls: {
+      matchers: {
+        color: /(background|color)$/i,
+        date: /Date$/i,
+      },
+    },
+    backgrounds: {
+      default: 'light',
+      values: [
+        { name: 'light', value: '#ffffff' },
+        { name: 'dark', value: '#000000' },
+      ],
+    },
+    viewport: {
+      viewports: {
+        mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
+        desktop: { name: 'Desktop', styles: { width: '1024px', height: '768px' } },
+      },
+    },
+  },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8732589 and a22be17.

📒 Files selected for processing (6)
  • frontend/packages/ui/.storybook/main.ts (1 hunks)
  • frontend/packages/ui/.storybook/preview.ts (1 hunks)
  • frontend/packages/ui/package.json (1 hunks)
  • frontend/packages/ui/src/hooks/useGroup.ts (3 hunks)
  • frontend/packages/ui/src/index.ts (1 hunks)
  • frontend/packages/ui/vite.config.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: frontend
🔇 Additional comments (5)
frontend/packages/ui/src/index.ts (1)

19-19: Export useCheckbox hook to public API
This adds useCheckbox to the package’s public surface. Ensure accompanying documentation or README updates to include usage examples for this new hook.

frontend/packages/ui/.storybook/main.ts (1)

1-15: Review Storybook main configuration
The main.ts correctly configures story paths and addons. Verify that a .storybook/preview.ts file is present for global decorators (themes, CSS resets, etc.), and confirm the Chromatic addon name (@chromatic-com/storybook) matches the installed package.

frontend/packages/ui/src/hooks/useGroup.ts (2)

1-2: Removed unused useEffect import
Good cleanup—useEffect is no longer needed after refactoring the initialization logic into the reducer.


70-70: Double-check initial state on prop changes
Since useReducer’s initial state is only applied on mount, updates to defaultCheckedList or itemIds won’t trigger reinitialization unless init() is called. Confirm this behavioral change is intended.

frontend/packages/ui/.storybook/preview.ts (1)

16-17: Export default preview is correct.

This file correctly exports the configured preview object for Storybook. No further changes needed here.

Copy link
Contributor

@hamo-o hamo-o left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!

Copy link

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

🧹 Nitpick comments (2)
frontend/packages/ui/.storybook/main.ts (2)

18-24: Rename the config parameter to avoid shadowing the outer config constant

The viteFinal callback receives a parameter named config, but there is already a const config declared in the parent scope. Shadowing can make the code harder to read and increases the risk of accidental misuse when the file grows. Simply renaming the parameter (e.g. to viteConfig) keeps intent crystal-clear.

-  viteFinal: async (config) => {
+  viteFinal: async (viteConfig) => {
     const { mergeConfig } = await import('vite');
@@
-    return mergeConfig(
-      config,
+    return mergeConfig(
+      viteConfig,
       {

32-38: Consider sourcing aliases from tsconfig.path.json to avoid drift

The manual alias map works, but as the project scales it’s easy for Vite/Storybook and TypeScript path aliases to diverge. Pointing to a shared config (or generating this map from compilerOptions.paths) eliminates duplication and prevents “works-in-Storybook but not in editor” issues.
If a dedicated tsconfig.paths.json already exists, you can pull it in with vite-tsconfig-paths instead of hard-coding each entry.

No code change required if you prefer the current approach.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc4a751 and 992be41.

📒 Files selected for processing (1)
  • frontend/packages/ui/.storybook/main.ts (1 hunks)

@dioo1461 dioo1461 merged commit ac77e68 into dev Jun 14, 2025
2 checks passed
@dioo1461 dioo1461 deleted the feature/fe/storybook-for-ui branch June 14, 2025 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🖥️ FE Frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants