Skip to content

Commit

Permalink
fix(tailwind): correct disabled tag styles (#7247)
Browse files Browse the repository at this point in the history
* fix(taggroup): add isDisabled to compoundVariants

this allows the styles defined in isDisabled to be applied

* test(taggroup): add disabled item

this shows the disabled styles in action

* style(taggroup): add dark text colors to improve contrast

* style(taggroup): update dark mode disabled styles

---------

Co-authored-by: Robert Snow <[email protected]>
  • Loading branch information
steveoh and snowystinger authored Oct 29, 2024
1 parent f598966 commit b01fbf2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion starters/tailwind/src/TagGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ const tagStyles = tv({
true: 'bg-blue-600 text-white border-transparent forced-colors:bg-[Highlight] forced-colors:text-[HighlightText] forced-color-adjust-none'
},
isDisabled: {
true: 'bg-gray-100 text-gray-300 forced-colors:text-[GrayText]'
true: 'bg-gray-100 dark:bg-transparent dark:border-white/20 text-gray-300 dark:text-zinc-600 forced-colors:text-[GrayText]'
}
},
compoundVariants: (Object.keys(colors) as Color[]).map((color) => ({
isSelected: false,
isDisabled: false,
color,
class: colors[color]
}))
Expand Down
2 changes: 1 addition & 1 deletion starters/tailwind/stories/TagGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default meta;
export const Example = (args: any) => (
<TagGroup {...args}>
<Tag>Chocolate</Tag>
<Tag>Mint</Tag>
<Tag isDisabled>Mint</Tag>
<Tag>Strawberry</Tag>
<Tag>Vanilla</Tag>
</TagGroup>
Expand Down

1 comment on commit b01fbf2

@rspbot
Copy link

@rspbot rspbot commented on b01fbf2 Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.