fix(table): differentiate selected bg color from striped bg color
Closes #1602
📝 Description
This PR contains 2 small changes:
- Override odd selected row background color when
isStripedistrue(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
-
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
selectionModeissingle). In this example, the last row is selected, but you cannot visually know:
🚀 New behavior
Selected rows now always show the selected color, no matter if the row is striped or not
Also, the selected default background color is slightly brighter now
💣 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.
🦋 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
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 |
@sjoerdvanBommel is attempting to deploy a commit to the NextUI Inc Team on Vercel.
A member of the Team first needs to authorize it.
[!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 reviewcommand 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?
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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto 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.yamlfile 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.