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(table): differentiate selected bg color from striped bg color #3221

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-ears-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/theme": patch
---

Differentiate selected bg color from striped bg color (#1602)
48 changes: 46 additions & 2 deletions packages/core/theme/src/components/table.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {VariantProps} from "tailwind-variants";

import {tv} from "../utils/tv";
import {dataFocusVisibleClasses} from "../utils";
import {tv} from "../utils/tv";

/**
* Table **Tailwind Variants** component
Expand Down Expand Up @@ -120,7 +120,7 @@ const table = tv({
variants: {
color: {
default: {
td: "before:bg-default/40 data-[selected=true]:text-default-foreground",
td: "before:bg-default/60 data-[selected=true]:text-default-foreground",
},
primary: {
td: "before:bg-primary/20 data-[selected=true]:text-primary",
Expand Down Expand Up @@ -273,6 +273,50 @@ const table = tv({
fullWidth: true,
align: "start",
},
compoundVariants: [
{
isStriped: true,
color: "default",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-default/60",
},
},
{
isStriped: true,
color: "primary",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-primary/20",
},
},
{
isStriped: true,
color: "secondary",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-secondary/20",
},
},
{
isStriped: true,
color: "success",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-success/20",
},
},
{
isStriped: true,
color: "warning",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-warning/20",
},
},
{
isStriped: true,
color: "danger",
class: {
td: "group-data-[odd=true]:data-[selected=true]:before:bg-danger/20",
},
},
],
});

export type TableVariantProps = VariantProps<typeof table>;
Expand Down
Loading