-
Notifications
You must be signed in to change notification settings - Fork 143
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
fix: less #714
Conversation
jc9702507
commented
May 8, 2023
- 修改rpx问题
🎊 PR Preview c53d33b has been successfully built and deployed to https://ant-design-ant-design-mini-preview-pr-714.surge.sh 🕐 Build time: 231.401s 🤖 By surge-preview |
@border-width-standard: 2 * @pixelSize; //标准 | ||
@border-width-thick: 4 * @pixelSize; //粗 | ||
@border-width-standard: 2 * @rpx; //标准 | ||
@border-width-thick: 4 * @rpx; //粗 | ||
|
||
@color-product-mask: fade(@COLOR_BLACK, @opacity-product-mask*100); //产品蒙层 | ||
@color-marketing-mask: fade( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码主要定义了一些 Less 变量,来规定样式中常用的尺寸、圆角、行高、图标大小等。建议将像素单位 @pixelsize 替换为设备无关像素单位 @rpx,并适当增加一些注释以提高可读性。此外,需要注意变量的命名规范,保证易于理解和维护。
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #714 +/- ##
=======================================
Coverage 24.02% 24.02%
=======================================
Files 158 158
Lines 3334 3334
Branches 875 875
=======================================
Hits 801 801
Misses 2202 2202
Partials 331 331 ☔ View full report in Codecov by Sentry. |
@border-width-standard: 2 * @pixelSize; //标准 | ||
@border-width-thick: 4 * @pixelSize; //粗 | ||
@border-width-standard: 2 * @rpx; //标准 | ||
@border-width-thick: 4 * @rpx; //粗 | ||
|
||
@color-product-mask: fade(@COLOR_BLACK, @opacity-product-mask*100); //产品蒙层 | ||
@color-marketing-mask: fade( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码主要定义了一些跟界面设计相关的尺寸、颜色等变量,该部分没有明显的 bug 风险。以下是一些可以进行改进的建议:
- 建议使用相对单位(如 rem 或 vw/vh)替代固定像素值,以适应不同屏幕大小及 DPI。
- 可以将变量名命名规范化,统一使用横线分隔单词,并且尽可能精简命名。
- 在 Less 中可以通过使用计算表达式减少重复定义,例如可以使用 @font-size-list 替换掉第二次出现的 @font-size-list。
- 建议在变量定义前添加注释,表明变量的用途和默认值,方便他人理解修改。