Skip to content

Commit

Permalink
fix: tag component not reading badge color and badge bg css variables (
Browse files Browse the repository at this point in the history
  • Loading branch information
hectoraldairah authored Mar 23, 2023
1 parent b39e242 commit 1dac7ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .changeset/late-pandas-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@chakra-ui/theme": major
"@chakra-ui/tag": major
---

- Fix issue where the tag component is not setting bg and color css variables
the variables are called `--badge-bg` and `--badge-color`. Those values are
already passed as CSS variable but not read. Editing the tag.ts file and make
a reference for those variables
2 changes: 1 addition & 1 deletion packages/components/tag/stories/tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
],
}

export const basic = () => <Tag>Gray</Tag>
export const basic = () => <Tag colorScheme="teal">Teal</Tag>

export const withSizes = () => (
<>
Expand Down
6 changes: 6 additions & 0 deletions packages/components/theme/src/components/tag.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import { tagAnatomy as parts } from "@chakra-ui/anatomy"
import {
createMultiStyleConfigHelpers,
cssVar,
defineStyle,
} from "@chakra-ui/styled-system"
import { badgeTheme } from "./badge"

const $bg = cssVar("badge-bg")
const $fg = cssVar("badge-color")

const { defineMultiStyleConfig, definePartsStyle } =
createMultiStyleConfigHelpers(parts.keys)

const baseStyleContainer = defineStyle({
fontWeight: "medium",
lineHeight: 1.2,
outline: 0,
color: $fg.reference,
bg: $bg.reference,
borderRadius: "md",
_focusVisible: {
boxShadow: "outline",
Expand Down

1 comment on commit 1dac7ee

@vercel
Copy link

@vercel vercel bot commented on 1dac7ee Mar 23, 2023

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.