nextui icon indicating copy to clipboard operation
nextui copied to clipboard

fix(table): differentiate selected bg color from striped bg color

Open sjoerdvanBommel opened this issue 1 year ago • 4 comments

Closes #1602

📝 Description

This PR contains 2 small changes:

  • Override odd selected row background color when isStriped is true (this used to stay the striped background color)
  • Differentiate a selected row from a striped row (these used to have the same bg color)

It is also my first PR in this repo, so please let me know if I'm missing something 😁

⛳️ Current behavior (updates)

  • A row does not have a seperate background color when selected in case it's a striped row image

  • The selected default background color is the same as the striped background color, which makes it hard to see which row is selected (especially when selectionMode is single). In this example, the last row is selected, but you cannot visually know: image

🚀 New behavior

Selected rows now always show the selected color, no matter if the row is striped or not

image

Also, the selected default background color is slightly brighter now

image

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

No

📝 Additional Information

I could not write a unit test for this as far as I'm aware, because I cannot get a before pseudo element in JavaScript. Would it be valuable to test if the td has a specific class? I'm willing to write that, but it felt wrong to test such implementation detail

Summary by CodeRabbit

  • New Features

    • Introduced new color themes for striped tables, enhancing visual customization options.
  • Style

    • Adjusted CSS classes within the table component for different color variants, improving the overall appearance and consistency.
  • Bug Fixes

    • Differentiated the selected background color from the striped background color to avoid visual confusion.

sjoerdvanBommel avatar Jun 09 '24 10:06 sjoerdvanBommel

🦋 Changeset detected

Latest commit: 047f9b434fdba49d06033e4eaea566ed6f3da9bf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nextui-org/theme Patch
@nextui-org/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 09 '24 10:06 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 8:38am

vercel[bot] avatar Jun 09 '24 10:06 vercel[bot]

@sjoerdvanBommel is attempting to deploy a commit to the NextUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jun 09 '24 10:06 vercel[bot]

[!WARNING]

Rate limit exceeded

@wingkwong has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 12 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between a70ce5510bdaf482e2176776ecb647a523b5851c and 047f9b434fdba49d06033e4eaea566ed6f3da9bf.

Walkthrough

The recent changes in the table.ts file within the @nextui-org/theme package address a bug related to the Table component's striped and color variants when using selection mode. Adjustments include reordering imports, modifying CSS class definitions, and adding compound variants for striped tables with different color themes to ensure proper coloring during selection. A patch differentiates the selected background color from the striped background color.

Changes

Files/Directories Change Summary
packages/core/theme/src/components/table.ts Reordered imports, adjusted CSS classes for color variants, and added compound variants for striped tables.
.changeset/beige-ears-laugh.md Introduced a patch to differentiate the selected background color from the striped background color.

Assessment against linked issues

Objective Addressed Explanation
Fix the bug where striped tables with color variants do not display correctly during selection (#1602)

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.

coderabbitai[bot] avatar Jun 09 '24 10:06 coderabbitai[bot]