feat(Tag): custom color support 3 variants#53097
Conversation
|
|
👁 Visual Regression Report for PR #53097 Failed ❌
Warning There are more diffs not shown in the table. Please check the Full Report for details. Important There are 54 diffs found in this PR: 🔄
|
WalkthroughThis pull request introduces a new feature to the Tag component, allowing custom colors to support two variants: 'outlined' and 'filled'. This change aims to reduce the visual difference between custom and preset colors by providing a consistent appearance. Changes
|
| tagStyle.background = color; | ||
| } else { | ||
| tagStyle.borderColor = color; | ||
| const hsl = new FastColor(color).toHsl(); |
There was a problem hiding this comment.
Ensure that the FastColor library is thoroughly tested with various color inputs to avoid unexpected behavior, especially with edge cases like very light or very dark colors.
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 7.84MB (199.3%) ⬆️
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
Files in
Files in
|
dd3fd4b to
80d6753
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #53097 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 779 780 +1
Lines 14066 14104 +38
Branches 3696 3708 +12
=========================================
+ Hits 14066 14104 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
80d6753 to
4676cd2
Compare
0dbf4ef to
7d131ef
Compare
7d131ef to
e60d6e4
Compare
| | --- | --- | --- | --- | --- | | ||
| | closeIcon | Custom close icon. 5.7.0: close button will be hidden when setting to `null` or `false` | ReactNode | false | 4.4.0 | | ||
| | color | Color of the Tag | string | - | | | ||
| | variant | Variant of the tag | `'borderless' \| 'filled' \| 'outlined'` | `'borderless'` | 6.0.0 | |
e60d6e4 to
a56e8ee
Compare
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
a56e8ee to
7c3bafd
Compare
| // ====================== Styles ====================== | ||
| const tagStyle = React.useMemo(() => { | ||
| let nextTagStyle: React.CSSProperties = { | ||
| ...contextStyles.root, |
There was a problem hiding this comment.
顺手用新的 semantic hooks 合并优化一下呗~





























中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
Tag 的 color 属性,在提供非预设颜色时,只能以实色填充展示,与内置颜色的外观差异巨大。另外 color="xxx-inverse" 和 borderless={false} 的用法也不够优雅。
此 PR 提供了一个额外的属性,
variant: 'outlined' | 'filled' | 'borderless',以统一内置颜色和自定义颜色的效果,同时提供三种变体。减少 xxx-reverse 预设数量,且不需要 borderless 属性。📝 Change Log