Skip to content

Conversation

@kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Nov 17, 2024

This PR adds a primitive component with asChild support

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a customizable Primitive.button component for improved styling and functionality.
    • Added a new Storybook configuration to demonstrate the Primitive component's capabilities.
  • Bug Fixes

    • Ensured accessibility features for the button component remain intact.
  • Tests

    • Implemented unit tests for the Primitive component to validate rendering and functionality.
  • Style

    • Restructured color tokens for improved readability and consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request primarily involve the introduction of a new Primitive component system, which replaces the native HTML <button> element in the ButtonPrimitive component with a custom <Primitive.button>. Additionally, a new Storybook configuration for the Primitive component is created, along with unit tests to verify its functionality. The color tokens have also been restructured for improved readability, though their underlying logic remains unchanged.

Changes

File Change Summary
src/core/primitives/Button/index.tsx Replaced <button> with <Primitive.button>, added import for Primitive.
src/core/primitives/Primitive/Primitive.stories.tsx Added Storybook stories for Primitive.button: Button and ButtonAsChild, with a default export.
src/core/primitives/Primitive/index.tsx Introduced generatePrimitive function and HTMLNODES array; exported Primitive object.
src/core/primitives/Primitive/tests/Primitive.test.js Added unit tests for Primitive components, verifying rendering and class application.
styles/jsTokens/colors.tokens.js Restructured color tokens for consistency and readability; changed string quotes from double to single.

Possibly related PRs

  • Add Accessible Button Primitive #401: The changes in this PR introduce the ButtonPrimitive component, which is directly related to the main PR's modification of the ButtonPrimitive component in src/core/primitives/Button/index.tsx.
  • Use Button Primitive in Toggle, ToggleGroup - and more QOL improvements #402: This PR updates the Toggle component to use the ButtonPrimitive, which is relevant as it shows the application of the changes made in the main PR regarding the ButtonPrimitive.
  • Release/0.0.22 #391: The changes in this PR include modifications to the Button component, which is related to the main PR's focus on the ButtonPrimitive component, indicating a broader context of button component updates.

🐰 In a world of buttons, oh so bright,
A new Primitive takes its flight.
With stories to tell and tests to run,
Our colorful tokens shine like the sun!
Hopping through code, we celebrate,
A whimsical change, oh isn't it great? 🌈

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.

src/core/primitives/Button/index.tsx

Oops! Something went wrong! :(

ESLint: 8.56.0

Error: Failed to load parser '@babel/eslint-parser' declared in '.eslintrc.cjs': Cannot find module '@babel/core/package.json'
Require stack:

  • /node_modules/@babel/eslint-parser/lib/parse.cjs
  • /node_modules/@babel/eslint-parser/lib/index.cjs
  • /node_modules/@eslint/eslintrc/dist/eslintrc.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object. (/node_modules/@babel/eslint-parser/lib/parse.cjs:14:19)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)

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.

@codecov
Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.10%. Comparing base (3ad695f) to head (f86cc5b).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/core/primitives/Primitive/index.tsx 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #564      +/-   ##
==========================================
- Coverage   92.30%   92.10%   -0.21%     
==========================================
  Files          12       13       +1     
  Lines          65       76      +11     
  Branches       15       16       +1     
==========================================
+ Hits           60       70      +10     
- Misses          5        6       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kotAPI kotAPI merged commit 2583bc3 into main Nov 17, 2024
5 of 7 checks passed
@kotAPI kotAPI deleted the pranay/primitive branch November 17, 2024 09:34
@coderabbitai coderabbitai bot mentioned this pull request May 7, 2025
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