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: CSS variables should allow simple HEX value #89

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Nov 26, 2023

Summary by CodeRabbit

  • Style

    • Updated the color formatting in UI components to use CSS variables with fallback values.
    • Removed specific border classes for a cleaner design.
  • Tests

    • Adjusted Button component tests to reflect the updated border styling logic.
  • Refactor

    • Enhanced the button border class application logic to be conditional, improving the flexibility of button styling.

Copy link

coderabbitai bot commented Nov 26, 2023

Walkthrough

The changes across the files reflect a shift towards more dynamic and conditional styling in a UI component library. The dynamicColors function now supports fallback values and alpha transparency, while the dynamicColorsClasses function has dropped specific border classes. The Button component's tests have been updated to reflect these styling changes. Additionally, the getButtonBorderClasses function has been refactored to conditionally apply border styles using the clsx utility, based on a noBorder flag.

Changes

File Path Change Summary
.../lib/twPlugin.js Updated dynamicColors to use var with fallback and alpha values; removed specific border classes in dynamicColorsClasses.
.../Button/__tests__/Button.test.tsx Modified border value in tests; updated class assertions to reflect new border styling logic.
.../Button/utilities.ts Refactored getButtonBorderClasses to conditionally apply border classes using clsx and noBorder parameter.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

Copy link

bundlemon bot commented Nov 26, 2023

BundleMon

Files updated (2)
Status Path Size Limits
assets/index.js
6.13KB (+11B +0.18%) 10KB
assets/style.css
3.33KB (-46B -1.33%) 4KB
Unchanged files (1)
Status Path Size Limits
index.html
316B 2KB

Total files change -35B -0.35%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link

@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 0263924 and 88a49f5.
Files selected for processing (3)
  • packages/ui-components/lib/twPlugin.js (3 hunks)
  • packages/ui-components/src/components/Button/tests/Button.test.tsx (2 hunks)
  • packages/ui-components/src/components/Button/utilities.ts (1 hunks)
Additional comments: 4
packages/ui-components/lib/twPlugin.js (1)
  • 52-57: The removal of specific border classes is noted. Ensure that this change aligns with the intended design and that no other parts of the codebase rely on these classes.
packages/ui-components/src/components/Button/__tests__/Button.test.tsx (2)
  • 33-37: The test has been updated to reflect the changes in the border class naming convention. Ensure that the actual implementation of the Button component matches these test expectations.

  • 112-117: The new test case for a button with no borders is correctly checking for the absence of the "border-border-dark" class and the presence of the "border-transparent" class. This aligns with the changes made to the Button component's styling logic.

packages/ui-components/src/components/Button/utilities.ts (1)
  • 89-95: The refactoring of getButtonBorderClasses using clsx for conditional class application is correct and improves maintainability. Ensure that the kind parameter values align with the expected class naming conventions throughout the application.

packages/ui-components/lib/twPlugin.js Show resolved Hide resolved
@aversini aversini merged commit 48d8870 into main Nov 26, 2023
4 checks passed
@aversini aversini deleted the fix-CSS-variables-should-allow-simple-HEX-value branch November 26, 2023 22:56
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