Skip to content

Conversation

@krau5
Copy link
Contributor

@krau5 krau5 commented Dec 5, 2024

Developed as a part of #589

There were numerous warnings while running the library, because React wants svg attributes to be camelCase, not kebab-case. I have adjusted such attributes and I have also fixed spacing in code examples in docs.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new examples and improved documentation for components like Callout, Toggle, and Progress.
  • Bug Fixes

    • Corrected SVG attribute naming conventions across multiple components to align with JSX standards (e.g., fill-rule to fillRule).
  • Documentation

    • Updated various documentation files for components, ensuring consistent import statements and improved formatting for readability.
  • Style

    • Enhanced code formatting for consistency, including the addition of semicolons and standardizing string usage in import statements.

These changes improve the overall user experience by providing clearer documentation and consistent code practices.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

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/button/page.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.

Walkthrough

This pull request includes various formatting and structural improvements across multiple JavaScript and SCSS files related to UI components. Changes involve standardizing import statements, adjusting function definitions for consistency, and enhancing the readability of JSX structures. Notable modifications include the transition of function declarations to arrow functions, updates to JSX attributes for camelCase compliance, and the addition of semicolons for better syntax adherence. The overall functionality of the components remains unchanged.

Changes

File Path Change Summary
docs/app/docs/components/accordion/docs/codeUsage.js Updated AccordionExample to an arrow function with implicit return; formatted code for consistency.
docs/app/docs/components/button/page.js Standardized import quotes; reformatted Arrow component and AvatarDocs for consistency.
docs/app/docs/components/callout/docs/codeUsage.js Introduced CalloutExample; updated imports and restructured Callout component.
docs/app/docs/components/callout/page.js Standardized import quotes; adjusted formatting of CalloutDocs and PAGE_NAME.
docs/app/docs/components/card/page.js Standardized import quotes; added new imports and reformatted AvatarDocs.
docs/app/docs/components/code/page.js Standardized import quotes; reformatted AvatarDocs and Documentation for clarity.
docs/app/docs/components/kbd/docs/codeUsage.js Refactored KbdExample for implicit return; updated import statement.
docs/app/docs/components/progress/docs/codeUsage.js Refactored ProgressExample to an arrow function with implicit return; formatted JSX for readability.
docs/app/docs/components/switch/docs/codeUsage.js Reformatted JavaScript and SCSS for consistency; no functional changes.
docs/app/docs/components/toggle-group/ToggleGroupWrapper.js Updated string literals and SVG attributes; reformatted arrow functions and return statements.
docs/app/docs/components/toggle-group/docs/codeUsage.js Reformatted ToggleGroupWrapper for readability; no functional changes.
docs/app/docs/components/toggle/ToggleWrapper.js Added semicolons; reformatted function declarations for consistency.
docs/app/docs/components/toggle/docs/codeUsage.js Updated ToggleExample to include pressed state; reformatted for readability.
docs/app/docs/first-steps/usage/page.js Standardized import quotes; reorganized PAGE_NAME and metadata export.
docs/app/docs/layout.tsx Standardized import quotes; reformatted Layout component for readability.
docs/app/landingComponents/AddToCartDemo.js Standardized import quotes; added semicolons for consistency.
docs/app/landingComponents/MusicAppPlayerDemo.js Standardized import quotes; reformatted components for readability.
docs/app/landingComponents/ToolbarDemo.js Standardized import quotes; added semicolons and improved formatting.
docs/app/landingComponents/TrafficAnalyticsDemo.js Standardized import quotes; improved formatting and variable scoping.
docs/components/Copy.js Standardized import quotes; added semicolons for consistency.
docs/components/Main/Main.js Reformatted MainLayout for consistency; simplified darkMode initialization.
docs/components/layout/Documentation/Documentation.js Standardized import quotes; adjusted return statements for consistency.
docs/components/layout/Documentation/helpers/CodeBlock.js Reformatted for consistent indentation; no functional changes.
docs/icons/Disc.js Updated SVG attributes to camelCase; added semicolons for consistency.
docs/icons/Home.js Updated SVG attributes to camelCase; added semicolons for consistency.
docs/icons/Play.js Updated SVG attributes to camelCase; added semicolons for consistency.
docs/icons/RightArrow.js Updated SVG attributes to camelCase; added semicolons for consistency.
docs/icons/Rocket.js Added semicolons for consistency; no functional changes.
docs/icons/Rows.js Added newline at the end of the file; updated SVG attributes to camelCase.
docs/icons/TrackNext.js Updated SVG attributes to camelCase; added semicolons for consistency.
docs/icons/TrackPrevious.js Updated SVG attributes to camelCase; added semicolons for consistency.
src/components/ui/Callout/stories/Callout.stories.js Updated SVG attributes to camelCase; no functional changes.
src/components/ui/Toggle/stories/Toggle.stories.js Updated SVG attributes to camelCase; no functional changes.
src/components/ui/ToggleGroup/stories/ToggleGroup.stories.js Updated SVG attributes to camelCase; no functional changes.
docs/app/docs/docsIndex.js Standardized string literals to single quotes; ensured consistent formatting in DOCS_SEO object.

Possibly related PRs

  • Better Accordion #363: The changes in the main PR involve restructuring the AccordionExample component, which is directly related to the accordion component updates in this PR, enhancing its functionality and accessibility.
  • Added bookmarklink component for headings and link sharing #602: The introduction of the BookMarkLink component in this PR enhances documentation usability, which may relate to the overall improvements in the accordion component's documentation in the main PR.

Suggested reviewers

  • kotAPI

🐰 In the code we hop and play,
With semicolons here to stay.
Formatting neat, our style refined,
Consistency is what we find.
So let’s rejoice, for changes made,
In every line, our care displayed! 🐇✨


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 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.

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

🧹 Outside diff range and nitpick comments (11)
docs/icons/Rows.js (1)

2-2: Consider formatting the SVG for better readability

The SVG markup is quite dense on a single line. Consider formatting it across multiple lines for better maintainability.

-    return <svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 12.85L1 12.85L1 14.15L14 14.15L14 12.85ZM14 8.85002L1 8.85002L1 10.15L14 10.15L14 8.85002ZM1 4.85003L14 4.85003L14 6.15003L1 6.15002L1 4.85003ZM14 0.850025L1 0.850025L1 2.15002L14 2.15002L14 0.850025Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>;
+    return (
+        <svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
+            <path
+                d="M14 12.85L1 12.85L1 14.15L14 14.15L14 12.85ZM14 8.85002L1 8.85002L1 10.15L14 10.15L14 8.85002ZM1 4.85003L14 4.85003L14 6.15003L1 6.15002L1 4.85003ZM14 0.850025L1 0.850025L1 2.15002L14 2.15002L14 0.850025Z"
+                fill="currentColor"
+                fillRule="evenodd"
+                clipRule="evenodd"
+            />
+        </svg>
+    );
docs/icons/RightArrow.js (1)

2-2: Consider formatting the SVG consistently with other icon components

For consistency with other icon components, consider formatting the SVG across multiple lines.

-    return <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>;
+    return (
+        <svg
+            width="15"
+            height="15"
+            viewBox="0 0 15 15"
+            fill="none"
+            xmlns="http://www.w3.org/2000/svg"
+        >
+            <path
+                d="M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z"
+                fill="currentColor"
+                fillRule="evenodd"
+                clipRule="evenodd"
+            />
+        </svg>
+    );
docs/app/docs/components/progress/docs/codeUsage.js (1)

8-8: Remove extra space in component props

There's an extra space between value={90} and the closing tag.

-    <Progress value={90}  />
+    <Progress value={90} />
docs/app/docs/components/card/page.js (1)

25-30: Fix inconsistent indentation in Card content

The nested content has inconsistent indentation which affects readability.

 <div className="font-medium">
-        Peter Kowalsky
+    Peter Kowalsky
 </div>
 <div className="text-xs text-gray-800">
-        Content Engineer
+    Content Engineer
 </div>
docs/app/docs/first-steps/usage/page.js (2)

33-33: Remove extra leading whitespace

There's unnecessary whitespace at the beginning of the text content which affects consistency.

-            <Text className="mb-2 text-gray-1000 font-light">  Rad UI is headless, meaning it doesn't come with any styles. But we do ship a default theme that you can use to get quickly started off the ground.</Text>
+            <Text className="mb-2 text-gray-1000 font-light">Rad UI is headless, meaning it doesn't come with any styles. But we do ship a default theme that you can use to get quickly started off the ground.</Text>

35-35: Use consistent quote style

For consistency with the import statements, consider using single quotes.

-                {'import "@radui/ui/themes/default.css";'}
+                {'import \'@radui/ui/themes/default.css\';'}
docs/components/Copy.js (1)

34-36: Remove extra semicolon in className

There's an unnecessary semicolon in the button's className string.

-                className=" m-0.5 mr-0 ml-2 px-1.5 py-1.5 border border-blue-500 text-sm font-bold rounded text-blue ;">
+                className="m-0.5 mr-0 ml-2 px-1.5 py-1.5 border border-blue-500 text-sm font-bold rounded text-blue">
docs/app/docs/components/accordion/docs/codeUsage.js (1)

4-4: Use consistent quote style across files

For consistency with other files in the codebase, consider using single quotes.

-import Accordion from "@radui/ui/Accordion";
+import Accordion from '@radui/ui/Accordion';

let items = [
  {
-    title: "React",
-    content: "React is a JavaScript library for building user interfaces."
+    title: 'React',
+    content: 'React is a JavaScript library for building user interfaces.'
  },
  {
-    title: "Angular",
-    content: "Angular is a platform and framework for building single-page client applications using HTML and TypeScript."
+    title: 'Angular',
+    content: 'Angular is a platform and framework for building single-page client applications using HTML and TypeScript.'
  },
  {
-    title: "Vue",
-    content: "Vue.js is a progressive framework for building user interfaces."
+    title: 'Vue',
+    content: 'Vue.js is a progressive framework for building user interfaces.'
  }
]

Also applies to: 8-8, 9-9, 12-12, 13-13, 16-16, 17-17

docs/components/Main/Main.js (3)

1-9: Consider extracting cookie logic into a custom hook

The dark mode persistence logic could be moved to a custom hook (e.g., useDarkMode) to improve reusability and separation of concerns.

Example implementation:

// hooks/useDarkMode.js
export const useDarkMode = (initialValue) => {
  const [darkMode, setDarkMode] = useState(initialValue);
  
  const toggleDarkMode = useCallback(() => {
    const toggledState = !darkMode;
    setDarkMode(toggledState);
    setCookie(null, 'darkMode', toggledState, {
      maxAge: 30 * 24 * 60 * 60,
      path: '/'
    });
  }, [darkMode]);
  
  return [darkMode, toggleDarkMode];
};

28-51: Optimize SVG components for better maintainability and accessibility

Consider the following improvements for the SVG components:

  1. Move them to a separate components/icons directory
  2. Wrap them with React.memo
  3. Add accessibility attributes

Example implementation:

// components/icons/DiscordLogo.js
import { memo } from 'react';

export const DiscordLogo = memo(() => (
  <svg 
    width="15" 
    height="15" 
    viewBox="0 0 15 15" 
    fill="none" 
    xmlns="http://www.w3.org/2000/svg"
    aria-label="Discord"
    role="img"
  >
    {/* SVG path */}
  </svg>
));

DiscordLogo.displayName = 'DiscordLogo';

53-95: Enhance accessibility and maintainability of the layout structure

Consider the following improvements:

  1. Add keyboard navigation support
  2. Use semantic HTML elements
  3. Consider using CSS modules or CSS-in-JS for better CSS scoping

Example improvements:

-<div className={`px-3 py-2 flex items-center justify-between border-b border-gray-500 sticky z-20 top-0 ${darkMode ? 'rad-ui-dark-theme bg-black' : 'bg-white'}`}>
+<header className={`px-3 py-2 flex items-center justify-between border-b border-gray-500 sticky z-20 top-0 ${darkMode ? 'rad-ui-dark-theme bg-black' : 'bg-white'}`}>
   <nav className='mr-3 flex space-x-8'>
     {/* Navigation content */}
   </nav>
-</div>
+</header>

-<Button color="gray" variant="surface" onClick={toggleDarkMode}>
+<Button 
+  color="gray" 
+  variant="surface" 
+  onClick={toggleDarkMode}
+  aria-label={`Switch to ${darkMode ? 'light' : 'dark'} mode`}
+>
   {/* Button content */}
 </Button>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7539a7f and 11110c7.

📒 Files selected for processing (34)
  • docs/app/docs/components/accordion/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/button/page.js (1 hunks)
  • docs/app/docs/components/callout/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/callout/page.js (1 hunks)
  • docs/app/docs/components/card/page.js (1 hunks)
  • docs/app/docs/components/code/page.js (2 hunks)
  • docs/app/docs/components/kbd/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/progress/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/switch/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/toggle-group/ToggleGroupWrapper.js (1 hunks)
  • docs/app/docs/components/toggle-group/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/toggle/ToggleWrapper.js (1 hunks)
  • docs/app/docs/components/toggle/docs/codeUsage.js (2 hunks)
  • docs/app/docs/first-steps/usage/page.js (3 hunks)
  • docs/app/docs/layout.tsx (2 hunks)
  • docs/app/landingComponents/AddToCartDemo.js (2 hunks)
  • docs/app/landingComponents/MusicAppPlayerDemo.js (1 hunks)
  • docs/app/landingComponents/ToolbarDemo.js (2 hunks)
  • docs/app/landingComponents/TrafficAnalyticsDemo.js (2 hunks)
  • docs/components/Copy.js (2 hunks)
  • docs/components/Main/Main.js (1 hunks)
  • docs/components/layout/Documentation/Documentation.js (4 hunks)
  • docs/components/layout/Documentation/helpers/CodeBlock.js (1 hunks)
  • docs/icons/Disc.js (1 hunks)
  • docs/icons/Home.js (1 hunks)
  • docs/icons/Play.js (1 hunks)
  • docs/icons/RightArrow.js (1 hunks)
  • docs/icons/Rocket.js (1 hunks)
  • docs/icons/Rows.js (1 hunks)
  • docs/icons/TrackNext.js (1 hunks)
  • docs/icons/TrackPrevious.js (1 hunks)
  • src/components/ui/Callout/stories/Callout.stories.js (1 hunks)
  • src/components/ui/Toggle/stories/Toggle.stories.js (1 hunks)
  • src/components/ui/ToggleGroup/stories/ToggleGroup.stories.js (1 hunks)
✅ Files skipped from review due to trivial changes (18)
  • docs/icons/TrackPrevious.js
  • src/components/ui/Toggle/stories/Toggle.stories.js
  • docs/app/docs/components/toggle/ToggleWrapper.js
  • src/components/ui/Callout/stories/Callout.stories.js
  • docs/icons/Home.js
  • docs/app/docs/components/switch/docs/codeUsage.js
  • docs/icons/Rocket.js
  • docs/components/layout/Documentation/helpers/CodeBlock.js
  • src/components/ui/ToggleGroup/stories/ToggleGroup.stories.js
  • docs/app/landingComponents/TrafficAnalyticsDemo.js
  • docs/app/docs/components/toggle-group/docs/codeUsage.js
  • docs/app/landingComponents/ToolbarDemo.js
  • docs/app/landingComponents/AddToCartDemo.js
  • docs/app/docs/layout.tsx
  • docs/icons/Play.js
  • docs/app/docs/components/toggle-group/ToggleGroupWrapper.js
  • docs/components/layout/Documentation/Documentation.js
  • docs/app/landingComponents/MusicAppPlayerDemo.js
🔇 Additional comments (10)
docs/icons/Rows.js (1)

1-2: LGTM! Correct usage of camelCase SVG attributes

The SVG attributes are properly using camelCase (fillRule, clipRule), which resolves the React warnings as intended.

docs/icons/RightArrow.js (1)

2-2: LGTM! Correct usage of camelCase SVG attributes

The SVG attributes are properly using camelCase (fillRule, clipRule), which resolves the React warnings as intended.

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

3-11: LGTM! Clear and well-structured documentation

The code example is clear and well-organized, effectively demonstrating the Progress component usage with both JavaScript and CSS sections.

Also applies to: 28-31

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

3-8: LGTM! Documentation spacing improvements look good.

The code example is well-structured with proper spacing and line breaks, making it more readable. The component example follows React best practices.

docs/icons/TrackNext.js (1)

1-2: LGTM! SVG attributes correctly use camelCase.

The SVG attributes have been properly converted from kebab-case (fill-rule, clip-rule) to camelCase (fillRule, clipRule), resolving the React warnings.

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

3-6: LGTM! Import statements are well-organized.

The import statements are properly spaced and organized.

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

3-17: LGTM! Code example formatting improvements enhance readability.

The changes improve the documentation's clarity by:

  • Consistent spacing around component definition
  • Clear separation of hooks and handlers
  • Well-structured JSX indentation
docs/icons/Disc.js (1)

2-2: LGTM! SVG attributes properly updated to React's camelCase format.

The changes correctly address React warnings by updating SVG attributes:

  • fill-rulefillRule
  • clip-ruleclipRule
docs/app/docs/components/code/page.js (1)

11-11: ⚠️ Potential issue

Update SVG attributes to React's camelCase format.

Similar to other SVG fixes in this PR, update the following attributes:

  • fill-rulefillRule
  • clip-ruleclipRule
-<path d="M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path>
+<path d="M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path>

Likely invalid or redundant comment.

docs/components/Copy.js (1)

23-23: ⚠️ Potential issue

Convert SVG attributes to camelCase

To resolve React warnings, SVG attributes should use camelCase instead of kebab-case.

-<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>
+<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>

Likely invalid or redundant comment.

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 (8)
docs/app/docs/components/callout/docs/codeUsage.js (2)

7-19: Improve code example formatting for better readability.

While the component structure is correct, the template literal's formatting could be improved to make it more readable in the documentation.

Consider this formatting:

 const CalloutExample = () => (
   <Callout color="red">
     <div className="flex items-start">
       <BookmarkIcon />
-
       <div className="ml-2">
         <Text className="font-bold">Error</Text>
         <Text>Something went wrong. Please try again later.</Text>
       </div>
     </div>
   </Callout>
 )

Line range hint 21-33: Standardize SCSS indentation.

The SCSS code block uses inconsistent indentation which could be standardized for better readability in the documentation.

Consider this formatting:

 .rad-ui-callout {
-    padding:16px;
-    border-radius:8px;
-     background-color: var(--rad-ui-color-accent-200);
-     color: var(--rad-ui-color-accent-950);
-     display: flex;
-     align-items: center;
-     font-weight: 300;
-     font-size: 14px;
-     gap:8px;
+  padding: 16px;
+  border-radius: 8px;
+  background-color: var(--rad-ui-color-accent-200);
+  color: var(--rad-ui-color-accent-950);
+  display: flex;
+  align-items: center;
+  font-weight: 300;
+  font-size: 14px;
+  gap: 8px;
 }
docs/components/Main/Main.js (1)

39-42: Consider improving dark mode configuration

Two suggestions for the dark mode implementation:

  1. Consider respecting user's system preference initially using prefers-color-scheme
  2. Extract cookie max age to a named constant
+const DARK_MODE_COOKIE_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
+
 setCookie(cookies, 'darkMode', toggledState, {
-    maxAge: 30 * 24 * 60 * 60,
+    maxAge: DARK_MODE_COOKIE_MAX_AGE,
     path: '/'
 });
docs/app/docs/components/card/page.js (2)

11-31: Consider consistent indentation in JSX structure.

While the component structure is good, the indentation could be more consistent. The JSX content is currently using varying indentation levels which might affect readability.

Apply this formatting:

 const CardDocs = () => {
-    return <div>
-        <Documentation
-            currentPage={PAGE_NAME} title='Card' description={`
+    return (
+        <div>
+            <Documentation
+                currentPage={PAGE_NAME}
+                title='Card'
+                description={`
             Cards are used to group related information and actions. They are used to display information in a structured way.
-        `}>
+                `}
+            >

18-28: Consider extracting the example card into a separate component.

The example card implementation could be extracted into a separate component for better maintainability and reusability across documentation.

docs/app/docs/components/button/page.js (3)

6-6: Consider using a more concise constant name.

The constant name 'BUTTON_DOCS' could be simplified to just 'Button' to match the pattern used in the Card component's page.

-const PAGE_NAME = 'BUTTON_DOCS';
+const PAGE_NAME = 'Button';

10-12: Consider moving Arrow component to a shared icons directory.

The Arrow component could be moved to a shared icons directory since it's a reusable UI element. Also, consider adding prop types for customization.

+import { type SVGProps } from 'react';
+
-const Arrow = () => {
+const Arrow = ({ className, ...props }: SVGProps<SVGSVGElement>) => {
-    return <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
+    return <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" className={className} {...props}>

21-23: Consider using className instead of inline styles.

For consistency with other components, consider using CSS classes instead of inline styles for layout.

-<div style={{ display: 'flex', gap: 20 }}>
+<div className="flex gap-5">
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 11110c7 and 6012dbf.

📒 Files selected for processing (7)
  • docs/app/docs/components/button/page.js (1 hunks)
  • docs/app/docs/components/callout/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/callout/page.js (1 hunks)
  • docs/app/docs/components/card/page.js (1 hunks)
  • docs/app/docs/components/code/page.js (2 hunks)
  • docs/app/docs/docsIndex.js (1 hunks)
  • docs/components/Main/Main.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/app/docs/docsIndex.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/app/docs/components/code/page.js
  • docs/app/docs/components/callout/page.js
🔇 Additional comments (3)
docs/app/docs/components/callout/docs/codeUsage.js (1)

4-5: ⚠️ Potential issue

Add missing import for BookmarkIcon component.

The example uses a BookmarkIcon component on line 10, but there's no import statement for it. This could confuse users trying to follow the example.

Add the import statement:

 import Callout from "@radui/ui/Callout";
 import Text from "@radui/ui/Text";
+import { BookmarkIcon } from "@radui/ui/icons";
docs/components/Main/Main.js (1)

45-47: 🛠️ Refactor suggestion

Add security attributes to external link handler

The window.open call should include security-related attributes for external links.

 const openLink = useCallback((url) => () => {
-    window.open(url, '_blank');
+    window.open(url, '_blank', 'noopener,noreferrer');
 }, []);

Likely invalid or redundant comment.

docs/app/docs/components/card/page.js (1)

1-9: LGTM! Clean import organization and proper constant naming.

The imports are well-organized and the PAGE_NAME constant correctly reflects the component being documented.

Copy link
Collaborator

@kotAPI kotAPI left a comment

Choose a reason for hiding this comment

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

Looks good, let's do smaller PRs from next time, ideally not to exceed 10-15 files unless absolutely necessary

@kotAPI kotAPI merged commit 297248b into rad-ui:main Dec 6, 2024
3 checks passed
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.

2 participants