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: add new config config.getCommonStyle config.getCompUnitless for genStyleUtils #10

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

YumoImer
Copy link
Contributor

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 工作流程
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

genStyleUtils 新增属性

在用 @ant-design/cssinjs-utils 重构 antd 的过程中,发现的问题:

genCommonStyle 函数被 genComponentStyleHook 使用,@ant-design/cssinjs-utils@1.0.0 版本将其扩展为 genComponentStyleHook 函数的 options.genCommonStyle 属性。这会导致一些问题:

  • 每次使用 genComponentStyleHook 都需要将 options.genCommonStyle 传入
  • 需进行封装,但在每个组件生成 useStyle 时会多一次函数调用

另外考虑参数命名的一致性,将 genCommonStyle 更名为 getCommonStyle

unitless 常量被 genStyleHooks 中使用,考虑通用性,将其抽象为 config.getCompUnitless

修复

修复了 genComponentStyleHook 内部的逻辑问题,该问题会导致基础样式异常。

📝 更新日志

语言 更新描述
🇺🇸 英文 add new config config.getCommonStyle config.getCompUnitless for genStyleUtils
🇨🇳 中文 genStyleUtils 新增配置属性 config.getCommonStyle config.getCompUnitless

@YumoImer YumoImer requested a review from zombieJ July 22, 2024 09:33
@YumoImer YumoImer merged commit 0157c9e into master Jul 22, 2024
7 checks passed
@YumoImer YumoImer deleted the feat/getCommonStyle branch July 22, 2024 09:55
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.

2 participants