Skip to content

Docs Layout improvements and error fixes#993

Merged
kotAPI merged 2 commits intomainfrom
kotapi/docs-fixes
Mar 27, 2025
Merged

Docs Layout improvements and error fixes#993
kotAPI merged 2 commits intomainfrom
kotapi/docs-fixes

Conversation

@kotAPI
Copy link
Copy Markdown
Collaborator

@kotAPI kotAPI commented Mar 27, 2025

Summary by CodeRabbit

  • Documentation

    • Streamlined table layouts throughout the documentation by removing extra containers, resulting in a more consistent and spacious display.
    • Repositioned and updated content blocks for improved clarity and readability.
    • Refreshed textual examples, with updated messaging for emphasis, strong, and text displays.
  • New Features

    • Added an interactive example showcasing emphasized text usage.
    • Introduced a dedicated, simplified display for keyboard shortcut information.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 27, 2025

Walkthrough

This pull request modifies several documentation pages by removing unnecessary <div> wrappers around the <Documentation.Table> component and repositioning table components within the layouts. It also updates text content and formatting in a few pages, refines code examples using dynamic source code retrieval, and introduces two new components: EmExample for demonstrating text emphasis and KeyboardInteractionsTable for rendering keyboard shortcut data. Minor adjustments to key assignments in table mapping are included. No changes affect exported APIs.

Changes

File(s) Change Summary
docs/app/docs/components/avatar/page.mdx, docs/app/docs/components/callout/page.mdx, docs/app/docs/components/heading/page.mdx, docs/app/docs/components/progress/page.mdx, docs/app/docs/components/switch/page.mdx, docs/app/docs/components/tooltip/page.mdx Removed <div className="max-w-screen-md"> wrappers around <Documentation.Table> affecting layout constraints.
docs/app/docs/components/blockquote/page.mdx, docs/app/docs/components/code/page.mdx Repositioned <Documentation.Table> component within the document structure to modify its placement.
docs/app/docs/components/strong/page.mdx, docs/app/docs/components/text/page.mdx Updated text content and structure (e.g., added <p> tag and changed displayed text).
docs/app/docs/components/em/docs/codeUsage.js, docs/app/docs/components/text/docs/codeUsage.js, docs/app/docs/components/strong/docs/codeUsage.js Modified code examples to use dynamic source retrieval and adjusted CSS formatting for compactness.
docs/app/docs/components/em/docs/EmExample.tsx, docs/app/docs/components/em/page.mdx Added new EmExample component to abstract and demonstrate text emphasis usage.
docs/components/layout/Documentation/Documentation.js, docs/components/layout/Documentation/helpers/KeyboardInteractionsTable.js Integrated new KeyboardInteractionsTable component in KeyboardShortcuts to streamline keyboard shortcut display.
docs/components/layout/Documentation/helpers/DocsTable.js Changed key assignment in table mappings from unique ids to array indices.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant "Docs Page"
    participant EmExample
    participant CardComponent
    participant TextComponent
    participant EmComponent

    User->>Docs Page: Open "em" documentation
    Docs Page->>EmExample: Render <EmExample />
    EmExample->>CardComponent: Build card layout
    CardComponent->>TextComponent: Render text content
    TextComponent->>EmComponent: Emphasize words
Loading
sequenceDiagram
    participant Documentation
    participant KeyboardShortcuts
    participant KeyboardInteractionsTable
    participant TableUI

    Documentation->>KeyboardShortcuts: Request keyboard shortcuts
    KeyboardShortcuts->>KeyboardInteractionsTable: Delegate rendering
    KeyboardInteractionsTable->>TableUI: Construct table with data
    TableUI-->>KeyboardInteractionsTable: Return rendered table
Loading

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • GoldGroove06

Poem

I'm a rabbit coding through the docs today,
Hopping past wrappers that once held sway.
Tables now run free without a tight embrace,
With EmExample and Keyboard tables in place.
I twitch my nose, joyful and light—merging changes feels just right!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

docs/app/docs/components/strong/docs/codeUsage.js

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/docs/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

docs/app/docs/components/em/docs/EmExample.tsx

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/docs/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

docs/app/docs/components/text/docs/codeUsage.js

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/docs/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 4 others
✨ 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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link
Copy Markdown
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

🧹 Nitpick comments (2)
docs/app/docs/components/em/page.mdx (1)

7-9: Minor Punctuation Suggestion in Documentation Description
The description “Em is used to emphasize text.” is clear; however, consider a brief review for consistent punctuation if needed (e.g., ensuring uniform sentence style across docs).

🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ... Em is used to emphasize text. `}> <Documentation.ComponentHe...

(UNLIKELY_OPENING_PUNCTUATION)

docs/app/docs/components/strong/page.mdx (1)

10-10: Improved example clarity and formatting.

The updated example better illustrates the intended use case of the Strong component by using a more contextual phrase and properly wrapping the content in a paragraph tag. This change is consistent with the update made in the corresponding codeUsage.js file.

Consider using a stronger word instead of "very important" to better demonstrate the component's purpose. The static analysis tool correctly points out that "very" is an overused intensifier.

-<p>This is a <Strong>very important</Strong> message.</p>
+<p>This is a <Strong>critical</Strong> message.</p>
🧰 Tools
🪛 LanguageTool

[style] ~10-~10: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...00'>

This is a very important message.

</div...

(EN_WEAK_ADJECTIVE)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c9d6a75 and 9f48b50.

📒 Files selected for processing (18)
  • docs/app/docs/components/avatar/page.mdx (1 hunks)
  • docs/app/docs/components/blockquote/page.mdx (2 hunks)
  • docs/app/docs/components/callout/page.mdx (0 hunks)
  • docs/app/docs/components/code/page.mdx (1 hunks)
  • docs/app/docs/components/em/docs/EmExample.tsx (1 hunks)
  • docs/app/docs/components/em/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/em/page.mdx (1 hunks)
  • docs/app/docs/components/heading/page.mdx (1 hunks)
  • docs/app/docs/components/progress/page.mdx (1 hunks)
  • docs/app/docs/components/strong/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/strong/page.mdx (1 hunks)
  • docs/app/docs/components/switch/page.mdx (1 hunks)
  • docs/app/docs/components/text/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/text/page.mdx (1 hunks)
  • docs/app/docs/components/tooltip/page.mdx (0 hunks)
  • docs/components/layout/Documentation/Documentation.js (2 hunks)
  • docs/components/layout/Documentation/helpers/DocsTable.js (1 hunks)
  • docs/components/layout/Documentation/helpers/KeyboardInteractionsTable.js (1 hunks)
💤 Files with no reviewable changes (2)
  • docs/app/docs/components/tooltip/page.mdx
  • docs/app/docs/components/callout/page.mdx
🧰 Additional context used
🧬 Code Definitions (1)
docs/components/layout/Documentation/Documentation.js (2)
docs/components/layout/Documentation/helpers/KeyboardInteractionsTable.js (1)
  • KeyboardInteractionsTable (7-29)
docs/app/docs/components/accordion/docs/codeUsage.js (2)
  • keyboardShortcuts (25-106)
  • keyboardShortcuts (25-106)
🪛 LanguageTool
docs/app/docs/components/strong/page.mdx

[style] ~10-~10: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...00'>

This is a very important message.

</div...

(EN_WEAK_ADJECTIVE)

docs/app/docs/components/em/page.mdx

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ... Em is used to emphasize text. `}> <Documentation.ComponentHe...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (15)
docs/app/docs/components/text/docs/codeUsage.js (1)

12-16: CSS Block Formatting Improvement
Moving the closing brace (}) up (removing extra empty lines) makes the CSS block more compact and improves code readability without altering functionality.

docs/app/docs/components/heading/page.mdx (1)

21-23: Removed Redundant Wrapper for Documentation.Table
The removal of the extra <div> wrapper (previously with max-w-screen-md) around the <Documentation.Table> component results in a cleaner DOM structure. Ensure that any necessary spacing or width constraints are now handled appropriately elsewhere in your styles or layout.

docs/app/docs/components/text/page.mdx (1)

10-10: Updated Text Message
Replacing the original text with the inspirational quote "The best way to predict the future is to invent it." refreshes the content without affecting the underlying functionality.

docs/app/docs/components/avatar/page.mdx (1)

21-23: Removed Redundant Wrapper for Documentation.Table
Eliminating the wrapping <div> around <Documentation.Table> simplifies the component structure. Verify that this change does not adversely affect the intended layout, especially regarding width constraints previously applied by max-w-screen-md.

docs/app/docs/components/em/page.mdx (2)

5-6: Import of EmExample Component
Adding the import of the new <EmExample /> component clarifies the source of the example and encapsulates the emphasis logic, contributing to better maintainability.


10-11: Replaced Inline Example with EmExample Component
Using <EmExample /> instead of inline JSX streamlines the file and centralizes example-related code in a dedicated component, improving reusability.

docs/app/docs/components/progress/page.mdx (1)

21-21: Layout simplification: Removed unnecessary div wrapper.

The removal of the extra <div className="max-w-screen-md"> wrapper around the table component creates a cleaner layout structure. This change aligns with best practices of avoiding unnecessary nested elements.

docs/app/docs/components/strong/docs/codeUsage.js (1)

6-7: Improved example clarity and formatting.

The updated example better illustrates the intended use case of the Strong component by using a more contextual phrase ("very important message") and properly wrapping the content in a paragraph tag.

docs/app/docs/components/switch/page.mdx (1)

18-19: Layout simplification: Removed unnecessary div wrapper.

The removal of the extra <div className="max-w-screen-md"> wrapper around the table component creates a cleaner layout structure. This change is consistent with the same pattern applied to other component documentation pages.

docs/app/docs/components/blockquote/page.mdx (1)

22-23: Layout improvement: Better table positioning

The table has been repositioned after all component examples, creating a more logical flow for readers. This follows a consistent pattern in the documentation where examples are displayed first, followed by the technical details table.

Also applies to: 36-38

docs/app/docs/components/em/docs/EmExample.tsx (1)

1-16: Well-structured example component

This new component is a good encapsulation of the Em usage examples. It provides a clear demonstration of the Em component in different contexts while maintaining consistent styling.

docs/components/layout/Documentation/Documentation.js (1)

11-11: Good refactoring to improve component reuse

The refactoring to use the dedicated KeyboardInteractionsTable component simplifies the code and improves maintainability. Using this specialized component instead of inline markup is a good practice.

Also applies to: 69-69

docs/app/docs/components/code/page.mdx (1)

15-15: Consistent documentation layout

This change aligns with the other documentation pages, improving consistency across the component documentation. The table now appears after the component examples, creating a better reading flow.

Also applies to: 19-20

docs/app/docs/components/em/docs/codeUsage.js (2)

1-4: Dynamic source code loading is an improvement

The implementation of getSourceCodeFromPath to dynamically fetch example source code is a good practice as it ensures documentation remains in sync with the actual component implementation.


11-11: CSS implementation is incomplete

The CSS section currently only has a placeholder 'todo' string. Consider implementing the actual CSS example for completeness.

Is there a plan to complete the CSS implementation, or should it reference a specific CSS file like the JavaScript example does?

Comment on lines +14 to +15
{columns.map((column, idx) => (
<Table.ColumnCellHeader key={idx}>{column.name}</Table.ColumnCellHeader>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Using array indices as React keys is not recommended

React documentation advises against using array indices as keys unless the list is static and won't be reordered, added to, or removed from. This can lead to performance issues and unexpected behavior if the data changes.

Consider using stable identifiers from your data:

- {columns.map((column, idx) => (
-   <Table.ColumnCellHeader key={idx}>{column.name}</Table.ColumnCellHeader>
+ {columns.map((column, idx) => (
+   <Table.ColumnCellHeader key={column.id || `col-${idx}`}>{column.name}</Table.ColumnCellHeader>

- {data.map((row, idx) => (
-   <Table.Row key={idx}>
+ {data.map((row, idx) => (
+   <Table.Row key={row.id || `row-${idx}`}>

- {columns.map((column, idx) => (
-   <Table.Cell key={idx}>{row[column.id]}</Table.Cell>
+ {columns.map((column, idx) => (
+   <Table.Cell key={column.id || `cell-${idx}`}>{row[column.id]}</Table.Cell>

Also applies to: 20-23

Comment on lines +7 to +29
const KeyboardInteractionsTable = ({ title = 'Keyboard Interactions', columns = [], data = [] }) => {
return <div className='my-10'>
<BookMarkLink id="keyboard-interactions"> <Heading as="h6" className="mb-4">{title}</Heading> </BookMarkLink>
<Table.Root>
<Table.Head>
<Table.Row>
{columns.map((column, idx) => (
<Table.ColumnCellHeader key={idx}>{column.name}</Table.ColumnCellHeader>
))}
</Table.Row>
</Table.Head>
<Table.Body>
{data.map((row, idx) => (
<Table.Row key={idx}>
{columns.map((column, idx) => (
<Table.Cell key={idx}>{row[column.id]}</Table.Cell>
))}
</Table.Row>
))}
</Table.Body>
</Table.Root>
</div>
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

New component closely resembles DocsTable with array index key issues

This new component has very similar structure to the DocsTable component with just a few differences:

  1. Different default title ('Keyboard Interactions' vs 'API Documentation')
  2. Additional margin class ('my-10')
  3. Different bookmark ID ('keyboard-interactions' vs 'api-documentation')

There are two concerns:

  1. Code duplication between this component and DocsTable
  2. Using array indices as React keys (same issue as in DocsTable)

Consider these improvements:

  1. Refactor to reuse DocsTable logic:
import DocsTable from './DocsTable';

const KeyboardInteractionsTable = ({ 
  title = 'Keyboard Interactions', 
  columns = [], 
  data = [] 
}) => {
  return (
    <div className='my-10'>
      <DocsTable 
        title={title}
        columns={columns}
        data={data}
        bookmarkId="keyboard-interactions"
      />
    </div>
  );
};

export default KeyboardInteractionsTable;
  1. Or if you prefer to keep them separate, fix the key issue:
- {columns.map((column, idx) => (
-   <Table.ColumnCellHeader key={idx}>{column.name}</Table.ColumnCellHeader>
+ {columns.map((column, idx) => (
+   <Table.ColumnCellHeader key={column.id || `col-${idx}`}>{column.name}</Table.ColumnCellHeader>

- {data.map((row, idx) => (
-   <Table.Row key={idx}>
+ {data.map((row, idx) => (
+   <Table.Row key={row.id || `row-${idx}`}>

- {columns.map((column, idx) => (
-   <Table.Cell key={idx}>{row[column.id]}</Table.Cell>
+ {columns.map((column, idx) => (
+   <Table.Cell key={column.id || `cell-${idx}`}>{row[column.id]}</Table.Cell>

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