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

docs: removed show more from code example #3373

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

Conversation

ankitts
Copy link
Contributor

@ankitts ankitts commented Jun 30, 2024

Closes #3242

📝 Description

This PR removes the additional step of clicking on Show More while viewing a code example in docs.

⛳️ Current behavior (updates)

Currently, to view a code example from docs fully, we need to click on the show more button.
Screenshot 2024-06-30 145407

🚀 New behavior

The code can be seen fully after switching to preview tab without the need to click one additional button.
Screenshot 2024-06-30 145331

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

No

📝 Additional Information

Summary by CodeRabbit

  • New Features

    • Simplified the CodeDemo and Sandpack components by removing the defaultExpanded prop.
    • Improved the SandpackCodeViewer component by removing unnecessary state management and simplifying logic.
  • Style

    • Updated sandpack.css to remove outdated styles and adjust scrollbar visibility.
  • Refactor

    • Removed unused imports and redundant code from SandpackCodeViewer component.

Copy link

changeset-bot bot commented Jun 30, 2024

⚠️ No Changeset found

Latest commit: 3b22d55

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 Jun 30, 2024

@ankitts 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

vercel bot commented Jun 30, 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 Jul 4, 2024 10:10am
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 10:10am

Copy link
Contributor

coderabbitai bot commented Jun 30, 2024

Walkthrough

The recent changes primarily focus on simplifying the Sandpack and CodeDemo components within the documentation. Specifically, the defaultExpanded prop and associated logic for these components have been removed. This alteration aims to streamline code example displays, eliminating unnecessary state management and extra user interactions, such as the "show more" button, thus improving usability and navigation speed in the documentation.

Changes

File Path Change Summary
apps/docs/components/docs/components/.../code-demo.tsx Removed defaultExpanded prop and its associated logic in the CodeDemo component.
apps/docs/components/sandpack/code-viewer.tsx Refactored SandpackCodeViewer component to eliminate unnecessary state management for expansion and simplify rendering logic.
apps/docs/components/sandpack/sandpack.tsx Removed the defaultExpanded prop from the Sandpack component.
apps/docs/styles/sandpack.css Removed and adjusted styles related to is-expanded class and scrollbar width for .cm-scroller.

Assessment against linked issues

Objective (Issue Number) Addressed Explanation
Remove "show more" button in code example sections (#3242)

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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 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 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 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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.
  • 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.

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

Outside diff range and nitpick comments (3)
apps/docs/components/docs/components/code-demo/code-demo.tsx (3)

Line range hint 1-2: Remove unused use client directive

The "use client"; directive is not necessary in this context and can be removed to clean up the code.

-"use client";

Line range hint 15-15: Remove redundant ESLint directive

The ESLint directive to disable react/display-name is not necessary if the components are properly named. Consider removing it if not needed.

-    // eslint-disable-next-line react/display-name

Line range hint 31-31: Remove redundant ESLint directive

The ESLint directive to disable react/display-name is not necessary if the components are properly named. Consider removing it if not needed.

-  // eslint-disable-next-line react/display-name
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9daef56 and ea97a3a.

Files selected for processing (3)
  • apps/docs/components/docs/components/code-demo/code-demo.tsx (4 hunks)
  • apps/docs/components/sandpack/code-viewer.tsx (4 hunks)
  • apps/docs/components/sandpack/sandpack.tsx (3 hunks)
Files skipped from review due to trivial changes (2)
  • apps/docs/components/sandpack/code-viewer.tsx
  • apps/docs/components/sandpack/sandpack.tsx
Additional comments not posted (1)
apps/docs/components/docs/components/code-demo/code-demo.tsx (1)

42-42: Ensure all function calls to CodeDemo match the new signature

The defaultExpanded prop has been removed, ensure that all function calls to CodeDemo have been updated accordingly.

Verification successful

All function calls to CodeDemo match the new signature

The defaultExpanded prop has been removed, and all function calls to CodeDemo have been updated accordingly.

  • No occurrences of defaultExpanded in the relevant files.
  • Confirmed usage of CodeDemo in the updated code.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `CodeDemo` match the new signature.

# Test: Search for the function usage. Expect: No occurrences of `defaultExpanded`.
rg --type typescript $'CodeDemo'

Length of output: 66



Script:

#!/bin/bash
# Description: Verify all function calls to `CodeDemo` match the new signature.

# Test 1: Search for the function usage. Expect: Occurrences of `CodeDemo` function calls.
rg 'CodeDemo' --type ts

# Test 2: Search for any occurrences of the `defaultExpanded` prop. Expect: No occurrences.
rg 'defaultExpanded' --type ts

Length of output: 2074

@wingkwong
Copy link
Member

@ankitts This issue is assigned to our team member. Next time please ask for an assignment before working on it. This would save both of our time and avoid duplicate work.

Copy link
Member

@winchesHe winchesHe left a comment

Choose a reason for hiding this comment

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

@ankitts Thx you for your working, I left some comments

apps/docs/components/sandpack/code-viewer.tsx Outdated Show resolved Hide resolved
apps/docs/components/sandpack/code-viewer.tsx Show resolved Hide resolved
apps/docs/components/sandpack/code-viewer.tsx Outdated Show resolved Hide resolved
apps/docs/components/sandpack/code-viewer.tsx Outdated Show resolved Hide resolved
apps/docs/components/sandpack/code-viewer.tsx Outdated Show resolved Hide resolved
@winchesHe
Copy link
Member

apps/docs/styles/sandpack.css

It can be deleted

.sp-code-viewer.is-expanded .cm-scroller {
  overflow: auto;
  padding-bottom: 50px;
}

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

Outside diff range and nitpick comments (1)
apps/docs/styles/sandpack.css (1)

Line range hint 44-46: Adjust the scrollbar styling to improve usability.

The scrollbar width has been set to 0px, which might affect usability. Consider keeping a minimal width for better user experience.

-  width: 0px
+  width: 5px
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea97a3a and 641492b.

Files selected for processing (1)
  • apps/docs/styles/sandpack.css (2 hunks)

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 641492b and 28caea9.

Files selected for processing (1)
  • apps/docs/components/sandpack/code-viewer.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/docs/components/sandpack/code-viewer.tsx

@ankitts
Copy link
Contributor Author

ankitts commented Jun 30, 2024

@ankitts Thx you for your working, I left some comments

Thank you for the comments :) I have made the said changes.

@ankitts ankitts requested a review from winchesHe June 30, 2024 18:57
@winchesHe
Copy link
Member

@wingkwong Could you help agree to the deployment document🫰

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 28caea9 and 3b22d55.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (1)
  • apps/docs/components/sandpack/code-viewer.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/docs/components/sandpack/code-viewer.tsx

@wingkwong wingkwong removed their assignment Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📋 Scope : Docs Related to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Documentation: Remove the "show more" button in the component's code example sections
4 participants