-
Notifications
You must be signed in to change notification settings - Fork 124
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: stepper #746
fix: stepper #746
Conversation
wyj580231
commented
May 26, 2023
- 1.8.0 启用component2以后Stepper 步进器样式出现错位 #738
🎊 PR Preview c051fd2 has been successfully built and deployed to https://ant-design-ant-design-mini-preview-pr-746.surge.sh 🕐 Build time: 682.867s 🤖 By surge-preview |
border-top-right-radius: 0; | ||
border-top-left-radius: 4 * @rpx; | ||
border-bottom-right-radius: 0; | ||
border-bottom-left-radius: 4 * @rpx; | ||
} | ||
|
||
&-button-disabled { | ||
& &-button-disabled { | ||
color: @COLOR_TEXT_ASSIST; | ||
} | ||
|
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.
这段代码是在一个样式文件中定义了一些按钮的样式。以下是我对代码的简要审核和建议:
-
第 10 行
"& &-button"
看起来略微冗长,不过从逻辑上讲,它是正确的,因为&
符号代表的是父级选择器。因此,如果要创建一个.foo-button
的按钮,在引用这个样式时,我们可以这样写:.foo { .button-styles &-button }
。所以这个代码块在语言层面上没有问题。 -
接下来几个规则集中使用了边框半径,建议将常量 @rpx 提取到变量中,例如 "@border-radius: 4 * @rpx",然后在规则集中使用 "@border-radius"。
-
在第 23 和 29 行中,可以将属性排序以提高可读性。你可以按以下顺序编排:display, position, box-sizing, width, height, margin, padding, overflow, border, background-color等。
希望这些建议能对你有所帮助。
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #746 +/- ##
=======================================
Coverage 24.00% 24.00%
=======================================
Files 158 158
Lines 3341 3341
Branches 876 876
=======================================
Hits 802 802
Misses 2207 2207
Partials 332 332 ☔ View full report in Codecov by Sentry. |
f41c30c
to
c051fd2
Compare
@@ -53,7 +53,7 @@ | |||
box-sizing: border-box; | |||
background-color: @COLOR_BACKGROUND; | |||
padding: 7 *@rpx 14 *@rpx; | |||
caret-color: #1677ff; | |||
caret-color: @COLOR_BRAND1; | |||
|
|||
&-disabled { | |||
opacity: 0.4; |
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.
这段代码实现了一个按钮组件的样式,并在不同状态下应用对应的样式。以下是一些改进和可能的风险:
- 第11行,使用 & &-button 似乎是重复的,建议改为 &-button。
- 第12-14行,可以考虑使用变量存储按钮尺寸(如 @btn-size:56),以提高可维护性。
- 第24-43行,涉及到边框半径和按钮状态的处理,这种代码结构可能会导致错误。建议将每个状态的 CSS 规则拆分为单独的类,并分别应用这些类而不是添加新的规则。
- 第47行,使用了硬编码的颜色值。建议使用与其他地方相同的变量或常量来更好地管理颜色。
- 最后6行,padding 可能受到响应性设计的约束。如果当前版本的 @rpx 大小不随屏幕宽度而调整,则需要调整 padding 尺寸。
风险:当前的代码片段只包含样式代码,而没有与 HTML 元素匹配。因此,我们无法确保它是否可以正常工作,而且还有其他潜在的风险,例如防止过度修饰或覆盖其他样式。