Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add shouldBlockScroll stories #4351

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from

Conversation

ryo-manba
Copy link
Member

@ryo-manba ryo-manba commented Dec 12, 2024

Related to #4325

📝 Description

Story was not enough, so it was added.

⛳️ Current behavior (updates)

🚀 New behavior

💣 Is this a breaking change (Yes/No):

📝 Additional Information

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Introduced a new property shouldBlockScroll for the Dropdown, Modal, and Popover components, enhancing their configurability.
    • Added new stories WithShouldBlockScroll for each component to demonstrate behavior with the shouldBlockScroll property set to both true and false.

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 3:20pm
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 3:20pm

Copy link

changeset-bot bot commented Dec 12, 2024

⚠️ No Changeset found

Latest commit: 6fc6b5d

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Warning

Rate limit exceeded

@ryo-manba has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fe4b830 and 6fc6b5d.

📒 Files selected for processing (1)
  • packages/components/navbar/stories/navbar.stories.tsx (2 hunks)

Walkthrough

The changes in this pull request introduce a new boolean property, shouldBlockScroll, to the Storybook configurations of the Dropdown, Modal, and Popover components. Each component now includes a new story titled WithShouldBlockScroll, which showcases the behavior of the components with this property set to both true and false. The modifications enhance the configurability of these components without altering their existing functionalities.

Changes

File Path Change Summary
packages/components/dropdown/stories/dropdown.stories.tsx Added shouldBlockScroll to argTypes and new story WithShouldBlockScroll.
packages/components/modal/stories/modal.stories.tsx Added new story WithShouldBlockScroll and shouldBlockScroll to argTypes.
packages/components/popover/stories/popover.stories.tsx Added new story WithShouldBlockScroll and shouldBlockScroll to argTypes.

Possibly related PRs

Suggested reviewers

  • wingkwong
  • jrgarciadev
  • winchesHe

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Experiment)
  • @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.

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.

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (5)
packages/components/modal/stories/modal.stories.tsx (2)

Line range hint 23-51: Add shouldBlockScroll to argTypes

The new shouldBlockScroll prop should be documented in the component's argTypes for proper Storybook integration.

   argTypes: {
+    shouldBlockScroll: {
+      control: {
+        type: "boolean",
+      },
+      description: "Whether to block scrolling when the modal is open",
+    },
     size: {
       control: {
         type: "select",
       },

353-367: Add JSDoc comment for the story

Add documentation to explain the purpose and behavior of the WithShouldBlockScroll story.

+/**
+ * Demonstrates the behavior of the Modal component with and without scroll blocking.
+ * When `shouldBlockScroll` is true, the background content cannot be scrolled while
+ * the modal is open.
+ */
 export const WithShouldBlockScroll = {
   render: (args) => {
packages/components/popover/stories/popover.stories.tsx (3)

Line range hint 13-82: Add shouldBlockScroll to argTypes

The new shouldBlockScroll prop should be documented in the component's argTypes for proper Storybook integration. This is a systematic issue also present in the Modal component.

   argTypes: {
+    shouldBlockScroll: {
+      control: {
+        type: "boolean",
+      },
+      description: "Whether to block scrolling when the popover is open",
+    },
     variant: {
       control: {
         type: "select",
       },

579-593: Add JSDoc comment for the story

Add documentation to explain the purpose and behavior of the WithShouldBlockScroll story.

+/**
+ * Demonstrates the behavior of the Popover component with and without scroll blocking.
+ * When `shouldBlockScroll` is true, the background content cannot be scrolled while
+ * the popover is open.
+ */
 export const WithShouldBlockScroll = {
   render: (args) => {

579-593: Consider extracting common story pattern

The WithShouldBlockScroll story implementation is identical across Modal and Popover components. Consider extracting this into a shared utility function to maintain consistency and reduce duplication.

Example implementation:

const createScrollBlockStory = (Template) => ({
  render: (args) => (
    <div className="flex gap-8">
      <Template {...args} shouldBlockScroll={false} />
      <Template {...args} shouldBlockScroll={true} />
    </div>
  ),
  args: {
    shouldBlockScroll: true,
  },
});

export const WithShouldBlockScroll = createScrollBlockStory(Template);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd86056 and 71f079d.

📒 Files selected for processing (3)
  • packages/components/dropdown/stories/dropdown.stories.tsx (2 hunks)
  • packages/components/modal/stories/modal.stories.tsx (2 hunks)
  • packages/components/popover/stories/popover.stories.tsx (1 hunks)
🔇 Additional comments (3)
packages/components/dropdown/stories/dropdown.stories.tsx (3)

102-106: LGTM! Well-structured argTypes definition

The shouldBlockScroll property is properly defined in argTypes with the correct control type.


824-838: LGTM! Complete implementation

The story implementation effectively demonstrates both states of the shouldBlockScroll prop and follows the established pattern. This implementation can serve as a reference for the Modal and Popover components.


102-106: Verify consistency across components

Let's ensure the implementation is consistent across all three components.

Also applies to: 824-838

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.

1 participant