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

feat(theme): add custom color support for badge components, close #453 #455

Merged
merged 5 commits into from
Feb 7, 2025

Conversation

sunnyboy-mu
Copy link
Contributor

@sunnyboy-mu sunnyboy-mu commented Feb 6, 2025

feat(theme): add custom color support for badge components

close #453

@pengzhanbo
Copy link
Owner

修改 PR 不需要重新发起新的 PR ,在你的创建此 PR 的 分支上 进行提交和推送 即可。

此 PR 还需要提出一些修改建议:

在旧版本中 type 的默认值为 tip,在此 PR 中不应该修改此默认行为,这会导致更新此版本的用户,在已使用的 <Badge text="xxx" /> 的组件上导致错误的渲染结果。 这里可以通过用户是否有传入 typecolor || bgColor 来进行条件互斥判断解决该问题。在 type 有值时直接使用 type 作为结果,在 未传入 type 时,检查是否有传入 color || bgColor 来判断是否使用 默认的 tip 值。

@sunnyboy-mu
Copy link
Contributor Author

此 PR 还需要提出一些修改建议:

在旧版本中 type 的默认值为 tip,在此 PR 中不应该修改此默认行为,这会导致更新此版本的用户,在已使用的 <Badge text="xxx" /> 的组件上导致错误的渲染结果。 这里可以通过用户是否有传入 typecolor || bgColor 来进行条件互斥判断解决该问题。在 type 有值时直接使用 type 作为结果,在 未传入 type 时,检查是否有传入 color || bgColor 来判断是否使用 默认的 tip 值。

type会始终有值,因为有withDefaults设置为tip;我使用了color || bgColor进行判断,满足条件优先使用color bgColor

@pengzhanbo pengzhanbo changed the title feat(theme): add custom color support for badge components feat(theme): add custom color support for badge components, close #453 Feb 7, 2025
@pengzhanbo pengzhanbo merged commit a2282f5 into pengzhanbo:main Feb 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] 徽章支持自定义颜色
2 participants