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

fix(docs): added ts example for infinite pagination #2534

Closed
wants to merge 2 commits into from

Conversation

kuri-sun
Copy link
Member

@kuri-sun kuri-sun commented Mar 16, 2024

Closes #2517

📝 Description

  1. Added TS code example to Infinite Pagination in the Table component.
Screen.Recording.2024-03-16.at.10.44.22.PM.mov



  1. I covered all these examples used to not show its preview and “Open In Sandbox” button. Make sure that keeping these as they were. This is the reason I set showOpenInCodeSandbox to false for them.
313408574-c37448df-0f52-44a4-8c1d-8bb15d24aeeb

313408626-a275e43d-24ac-4847-b7e5-75cc87fb9322

313408644-673bfea8-9b5d-4ebe-9b01-d1c4bd54c1c7

313408683-d9ef8fdf-6731-474a-8971-b55aa2694f98

Screenshot 2024-03-16 at 10 55 54 PM

button

image

link

⛳️ Current behavior (updates)

  • Only JS code example.
  • When showOpenInCodeSandbox is false, still shows the “Open In Sandbox” button, unless we set showPreview to false.

🚀 New behavior

  • Added TS example, following Async Filter example.
  • Differentiate the responsibility between showOpenInCodeSandbox and showPreview to be able to show users the preview, while not showing the “Open In Sandbox” button.

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

No.

📝 Additional Information

Summary by CodeRabbit

  • New Features
    • Implemented infinite pagination in the Table component, enhancing data display with dynamic loading as the user scrolls.
  • Enhancements
    • The CodeDemo component now defaults to showing the "Open in CodeSandbox" option, improving accessibility for live code experimentation.
  • Documentation
    • Updated documentation for Button, Link, Avatar, and Image components to include or exclude the "Open in CodeSandbox" option in code demos, reflecting customization capabilities.
    • Enhanced Table component documentation with details on implementing infinite pagination using new imports and functionalities.

Copy link

changeset-bot bot commented Mar 16, 2024

⚠️ No Changeset found

Latest commit: ffcb957

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

vercel bot commented Mar 16, 2024

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

Name Status Preview Comments Updated (UTC)
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 2:02pm

Copy link
Contributor

coderabbitai bot commented Mar 16, 2024

Walkthrough

The summary of changes indicates enhancements and fixes across various components in a documentation application. Notably, it includes the introduction of a default value for the showOpenInCodeSandbox prop in the CodeDemo component, refactoring for infinite pagination in the Table component, and specific updates across multiple documentation pages to either include or exclude the CodeDemo component from opening in CodeSandbox. These changes aim to improve the developer experience and the functionality of the documentation site.

Changes

File Path Change Summary
.../code-demo/code-demo.tsx Default value for showOpenInCodeSandbox set to true; logical OR condition removed.
.../components/table/infinite-pagination.ts Implemented infinite pagination with sticky headers using Table, useAsyncList, and useInfiniteScroll.
Various .mdx files Added or updated showOpenInCodeSandbox prop in CodeDemo components across multiple documentation pages.
.../docs/components/table.mdx Added imports for useInfiniteScroll and useAsyncList; adjusted code for infinite pagination.

Assessment against linked issues

Objective Addressed Explanation
Define an interface for items pulled from the API in the infinite pagination example and use it with useAsyncList (#2517)
Ensure the infinite pagination example runs out-of-the-box in a Next.js environment (#2517)

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

vercel bot commented Mar 16, 2024

@kuri-sun is attempting to deploy a commit to the NextUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between e67b3af and ffcb957.
Files selected for processing (8)
  • apps/docs/components/docs/components/code-demo/code-demo.tsx (2 hunks)
  • apps/docs/content/components/table/infinite-pagination.ts (1 hunks)
  • apps/docs/content/docs/components/autocomplete.mdx (3 hunks)
  • apps/docs/content/docs/components/avatar.mdx (2 hunks)
  • apps/docs/content/docs/components/button.mdx (1 hunks)
  • apps/docs/content/docs/components/image.mdx (1 hunks)
  • apps/docs/content/docs/components/link.mdx (1 hunks)
  • apps/docs/content/docs/components/table.mdx (1 hunks)
Additional comments: 13
apps/docs/components/docs/components/code-demo/code-demo.tsx (2)
  • 62-62: The change to default showOpenInCodeSandbox to true aligns with the PR objectives and enhances the component's flexibility by allowing explicit control over the visibility of the "Open In Sandbox" button.
  • 145-145: Correct implementation of the showOpenInCodeSandbox prop within the DynamicSandpack component, ensuring consistent management of the "Open In Sandbox" button's visibility across examples.
apps/docs/content/components/table/infinite-pagination.ts (1)
  • 70-151: The addition of the TypeScript example for infinite pagination with the Table component significantly enhances the documentation by providing a type-safe implementation. This aligns with the PR objectives and benefits TypeScript users.
apps/docs/content/docs/components/image.mdx (1)
  • 68-68: Setting showOpenInCodeSandbox={false} for the CodeDemo component in this example aligns with the PR objectives to streamline the user experience by differentiating between showOpenInCodeSandbox and showPreview flags.
apps/docs/content/docs/components/avatar.mdx (2)
  • 79-79: The addition of showOpenInCodeSandbox={false} for the custom implementation example aligns with the PR's objective to adjust Code Sandbox visibility. This change ensures users can view the example without the "Open In Sandbox" button, simplifying the UI.
  • 124-124: Similarly, setting showOpenInCodeSandbox={false} for the Avatar Group's custom implementation example is consistent with the PR's goal to enhance the UI experience by hiding the "Open In Sandbox" button where it's deemed unnecessary.
apps/docs/content/docs/components/link.mdx (1)
  • 92-92: The addition of showOpenInCodeSandbox={false} to the CodeDemo component for the "Custom implementation" section is a clear and effective way to align with the PR's objective of adjusting Code Sandbox visibility. This change ensures that users can focus on the example content without the distraction of an "Open In Sandbox" button, which is not necessary for this context.
apps/docs/content/docs/components/button.mdx (1)
  • 91-91: The addition of showOpenInCodeSandbox={false} to the CodeDemo component for the "Custom Implementation" section effectively hides the "Open In Sandbox" button. This change aligns with the PR's objective to differentiate between showOpenInCodeSandbox and showPreview flags across various examples. It's a thoughtful update that simplifies the user interface by focusing on the most relevant actions for the user.
apps/docs/content/docs/components/table.mdx (2)
  • 277-283: The addition of useInfiniteScroll and useAsyncList imports is a positive change, ensuring that the Infinite Pagination example is up-to-date with the necessary hooks for implementation. This aligns well with the PR's objective to enhance the documentation and examples provided by NextUI, specifically targeting the Table component's Infinite Pagination feature.
  • 300-301: Adjusting the showPreview and showOpenInCodeSandbox flags for the Infinite Paginated Table example is a thoughtful change. It improves the user experience by making the example previews visible without the distraction of the "Open In Sandbox" button. This change aligns with the PR's objective to differentiate between these flags across various component examples.
apps/docs/content/docs/components/autocomplete.mdx (3)
  • 208-208: Setting showOpenInCodeSandbox={false} for the "Fully Controlled" example aligns with the PR's objective to differentiate between showOpenInCodeSandbox and showPreview flags, enhancing the user experience by streamlining the visibility of the "Open In Sandbox" button.
  • 258-258: Setting showOpenInCodeSandbox={false} for the "Asynchronous Filtering" example is consistent with the PR's goal to improve the documentation's usability by adjusting the visibility of the "Open In Sandbox" button.
  • 285-285: Applying showOpenInCodeSandbox={false} to the "Asynchronous Loading" example supports the PR's intention to refine the user interface by selectively displaying the "Open In Sandbox" button, making the documentation more focused and user-friendly.

Comment on lines 89 to 95

In case you need to customize the link even further, you can use the `useLink` hook to create your own implementation.

<CodeDemo showPreview={false} title="Custom implementation" files={linkContent.customImpl} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="Custom implementation" files={linkContent.customImpl} />

<Spacer y={4} />{" "}

Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [71-71]

Consider changing "client side routers" to "client-side routers" to adhere to grammatical conventions for compound adjectives.

- client side routers
+ client-side routers

@kuri-sun
Copy link
Member Author

@kuri-sun kuri-sun self-assigned this Apr 13, 2024
@kuri-sun kuri-sun closed this by deleting the head repository Apr 14, 2024
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.

[BUG] - Table
1 participant