-
Notifications
You must be signed in to change notification settings - Fork 271
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 space var to adapt to old theme #2581
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,8 @@ | |
--tv-space-md: calc(var(--tv-space-base) * 2); | ||
--tv-space-lg: calc(var(--tv-space-base) * 3); | ||
--tv-space-xl: calc(var(--tv-space-base) * 4); | ||
--tv-space-xxl: calc(var(--tv-space-base) * 5); // 内容块之间的间距 | ||
--tv-space-xxxl: calc(var(--tv-space-base) * 8); // 容器与容器内容的间距 | ||
Comment on lines
+414
to
+415
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Consider replacing hardcoded spacing values with new CSS variables The verification reveals:
To maintain consistency, consider:
🔗 Analysis chainVerify consistent usage of new spacing variables. Let's ensure these new spacing variables are being used consistently across components. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for any existing usage of these new spacing variables
rg "var\(--tv-space-xx+l\)" --type css --type less
# Check for any hardcoded values that might need to be replaced with these variables
rg "(margin|padding).+?(?:20px|32px)" --type css --type less
Length of output: 8021 |
||
--tv-space-table-x: 2px; // 表格单元格水平间距基准 | ||
--tv-space-table-y: 1px; // 表格单元格垂直间距基准 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,9 @@ | |
// 标签栏边框色 | ||
--tv-Tabs-border-color: var(--tv-color-border-divider, #f0f0f0); | ||
// 标签栏新增按钮高度 | ||
--tv-Tabs-new-height: calc(var(--tv-space-base, 4px) * 4.5); | ||
--tv-Tabs-new-height: 18px; | ||
// 标签栏新增按钮宽度 | ||
--tv-Tabs-new-width: calc(var(--tv-space-base, 4px) * 4.5); | ||
--tv-Tabs-new-width: 18px; | ||
// 标签栏新增按钮填充色 | ||
--tv-Tabs-new-svg-text-color: var(--tv-color-text-weaken, #808080); | ||
// 标签栏更多文字悬浮文本色 | ||
|
@@ -60,7 +60,7 @@ | |
// button-card类型small尺寸标签栏字号 | ||
--tv-Tabs-small-button-card-font-size: var(--tv-font-size-sm, 12px); | ||
// card类型small尺寸标签项右外边距(new) | ||
--tv-Tabs-small-item-margin-right: calc(var(--tv-space-base, 4px) * 6); | ||
--tv-Tabs-small-item-margin-right: 24px; | ||
// card类型small尺寸标签项水平内边距(new) | ||
--tv-Tabs-small-separator-padding-horizontal: var(--tv-space-lg, 12px); | ||
// card类型small尺寸标签项字号(new) | ||
|
@@ -84,15 +84,15 @@ | |
// bordercard类型非选中项文本色 | ||
--tv-Tabs-dark-text-color: var(--tv-color-text-disabled, #c2c2c2); | ||
// bordercard类型标签项上外边距 | ||
--tv-Tabs-dark-margin-top: calc(var(--tv-space-base, 4px) + 1px); | ||
--tv-Tabs-dark-margin-top: 5px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Review unusual spacing values The current values raise some concerns:
- --tv-Tabs-dark-margin-top: 5px;
+ --tv-Tabs-dark-margin-top: var(--tv-space-base, 4px);
- --tv-Tabs-dark-item-height: 47px;
+ --tv-Tabs-dark-item-height: var(--tv-size-height-xl, 48px); Also applies to: 95-95 |
||
// bordercard类型首个标签项左外边距 | ||
--tv-Tabs-dark-first-margin-left: 20px; | ||
// bordercard类型标签栏边框厚度 | ||
--tv-Tabs-dark-border-weight: 0px; | ||
// bordercard类型默认背景色 | ||
--tv-Tabs-header-dark-bg-color: var(--tv-color-bg-dark, #191919); | ||
// bordercard类型标签项高度 | ||
--tv-Tabs-dark-item-height: calc(var(--tv-size-base, 4px) * 11.75); | ||
--tv-Tabs-dark-item-height: 47px; | ||
// 标签项超出时上下按钮尺寸 | ||
--tv-Tabs-prev-next-btn-icon-size: var(--tv-font-size-default, 14px); | ||
// 标签项默认右外边距 | ||
|
@@ -136,15 +136,15 @@ | |
// 头部更多按钮水平内边距 | ||
--tv-Tabs-more-icon-padding-horizontal: 13.5px; | ||
// 头部更多图标盒子高度 | ||
--tv-Tabs-more-icon-height: calc(var(--tv-size-base, 4px) * 13); | ||
--tv-Tabs-more-icon-height: 52px; | ||
// 头部更多图标尺寸 | ||
--tv-Tabs-more-icon-size: var(--tv-font-size-heading-xs, 16px); | ||
// 头部更多按钮左侧盒子阴影高度 | ||
--tv-Tabs-more-left-box-height: calc(var(--tv-size-base, 4px) * 13); | ||
--tv-Tabs-more-left-box-height: 52px; | ||
// 内容垂直外边距 | ||
--tv-Tabs-content-margin-vertical: var(--tv-space-lg, 12px); | ||
// 内容水平外边距 | ||
--tv-Tabs-content-margin-horizontal: 0px; | ||
--tv-Tabs-content-margin-horizontal: 0; | ||
// buttoncard类型标签栏背景色 | ||
--tv-Tabs-button-card-nav-bg-color: var(--tv-color-bg, #f5f5f5); | ||
// buttoncard类型选项文本色 | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -60,7 +60,7 @@ | |||||
// 节点标题上外边距 | ||||||
--tv-Wizard-node-title-margin-top: var(--tv-space-md, 8px); | ||||||
// 页向导模式按钮组上外边距 | ||||||
--tv-Wizard-button-group-margin-top: calc(var(--tv-space-base, 4px) * 9); | ||||||
--tv-Wizard-button-group-margin-top: 36px; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider keeping the calculated value for better theme adaptability The change from This change also introduces inconsistency, as other spacing variables in the file continue to use CSS variables (e.g., Consider reverting to the calculated value: --- --tv-Wizard-button-group-margin-top: 36px;
+++ --tv-Wizard-button-group-margin-top: calc(var(--tv-space-base, 4px) * 9); 📝 Committable suggestion
Suggested change
|
||||||
// 页向导模式按钮左外边距 | ||||||
--tv-Wizard-button-margin-left: var(--tv-space-lg, 12px); | ||||||
// 垂直模式线条宽度 | ||||||
|
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.
💡 Codebase verification
Consider maintaining calculated width for consistency
The codebase shows consistent usage of calculated widths based on
--tv-size-base
across multiple components:Replacing the calculated width with a fixed value in the Anchor component deviates from this pattern and could impact:
Consider reverting to
calc(var(--tv-size-base, 4px) * 40)
to maintain consistency with the design system.🔗 Analysis chain
Consider maintaining flexibility with calculated values
Replacing
calc(var(--tv-size-base, 4px) * 40)
with a fixed160px
reduces the component's flexibility. While this might help compatibility with an old theme, it could impact:Let's check if other components still use calculated widths:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 18147