Skip to content

Commit 2f16669

Browse files
authored
feat: add space var to adapt to old theme (#2581)
1 parent 2a8d87d commit 2f16669

File tree

17 files changed

+54
-48
lines changed

17 files changed

+54
-48
lines changed

packages/theme/src/anchor/vars.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.inject-anchor-vars() {
1414
// 组件宽度
15-
--tv-Anchor-width: calc(var(--tv-size-base, 4px) * 40);
15+
--tv-Anchor-width: 160px;
1616
// 组件默认背景色
1717
--tv-Anchor-bg-color: var(--tv-color-bg-secondary, #fff);
1818
// 锚点默认文本色

packages/theme/src/base/old-theme.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@
412412
--tv-space-md: calc(var(--tv-space-base) * 2);
413413
--tv-space-lg: calc(var(--tv-space-base) * 3);
414414
--tv-space-xl: calc(var(--tv-space-base) * 4);
415+
--tv-space-xxl: calc(var(--tv-space-base) * 5); // 内容块之间的间距
416+
--tv-space-xxxl: calc(var(--tv-space-base) * 8); // 容器与容器内容的间距
415417
--tv-space-table-x: 2px; // 表格单元格水平间距基准
416418
--tv-space-table-y: 1px; // 表格单元格垂直间距基准
417419

packages/theme/src/base/vars.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@
413413
--tv-space-md: calc(var(--tv-space-base) * 2);
414414
--tv-space-lg: calc(var(--tv-space-base) * 3);
415415
--tv-space-xl: calc(var(--tv-space-base) * 4);
416+
--tv-space-xxl: calc(var(--tv-space-base) * 6); // 内容块之间的间距
417+
--tv-space-xxxl: calc(var(--tv-space-base) * 8); // 容器与容器内容的间距
416418
--tv-space-table-x: 4px; // 表格单元格水平间距基准
417419
--tv-space-table-y: 4px; // 表格单元格垂直间距基准
418420

packages/theme/src/calendar-view/index.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
.inject-CalendarView-vars();
2121
width: 100%;
2222
height: auto;
23-
padding-top: 32px;
23+
padding-top: var(--tv-CalendarView-padding);
2424
border: 1px solid #ebebeb;
2525
background-color: var(--tv-CalendarView-bg-color);
2626
overflow: auto;
@@ -30,7 +30,7 @@
3030
justify-content: space-between;
3131
align-items: center;
3232
margin-bottom: 18px;
33-
padding: 0 32px;
33+
padding: 0 var(--tv-CalendarView-padding);
3434
}
3535
&__header div:first-child {
3636
flex-grow: 1;

packages/theme/src/calendar-view/vars.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
.inject-CalendarView-vars() {
1414
// 视图容器、背景色
1515
--tv-CalendarView-bg-color: var(--tv-color-bg-secondary);
16+
// 日历容器与内容的间距
17+
--tv-CalendarView-padding: var(--tv-space-xxxl);
1618
// picker右边距
1719
--tv-CalendarView-picker-right-bottom: var(--tv-space-md);
1820
// radio 文本色、背景色、悬浮色

packages/theme/src/dialog-box/index.less

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060

6161
& &__header {
62-
padding: 32px 32px 24px;
62+
padding: var(--tv-DialogBox-padding) var(--tv-DialogBox-padding) 24px;
6363
background: var(--tv-DialogBox-bg-color);
6464
font-weight: var(--tv-DialogBox-head-title-font-weight);
6565
display: flex;
@@ -116,7 +116,7 @@
116116

117117
& &__body {
118118
text-align: left;
119-
padding: 0 32px;
119+
padding: 0 var(--tv-DialogBox-padding);
120120
color: var(--tv-DialogBox-body-text-color);
121121
font-size: var(--tv-DialogBox-body-font-size);
122122

@@ -135,7 +135,7 @@
135135
}
136136

137137
& &__footer {
138-
padding: 24px 32px 32px;
138+
padding: 24px var(--tv-DialogBox-padding) var(--tv-DialogBox-padding);
139139
text-align: right;
140140
box-sizing: border-box;
141141

@@ -162,12 +162,12 @@
162162
.@{dialog-box-prefix-cls}__header,
163163
.@{dialog-box-prefix-cls}__footer {
164164
width: calc(100% - 64px);
165-
margin-left: 32px;
166-
margin-right: 32px;
165+
margin-left: var(--tv-DialogBox-padding);
166+
margin-right: var(--tv-DialogBox-padding);
167167
}
168168

169169
.@{dialog-box-prefix-cls}__header {
170-
padding: 32px 0 20px;
170+
padding: var(--tv-DialogBox-padding) 0 24px;
171171
border-bottom: 1px solid var(--tv-DialogBox-head-divider-border-color);
172172

173173
&btn {
@@ -180,11 +180,11 @@
180180
overflow: auto;
181181
color: var(--tv-DialogBox-drawer-body-color);
182182
border-bottom: 1px solid var(--tv-DialogBox-drawer-divider-border-color);
183-
padding: 0 32px;
183+
padding: 0 var(--tv-DialogBox-padding);
184184
}
185185

186186
.@{dialog-box-prefix-cls}__footer {
187-
padding: 24px 0 32px;
187+
padding: 24px 0 var(--tv-DialogBox-padding);
188188
text-align: right;
189189
}
190190
}

packages/theme/src/dialog-box/vars.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
--tv-DialogBox-border-radius: var(--tv-border-radius-lg);
1818
// 对话框阴影
1919
--tv-DialogBox-shadow: var(--tv-shadow-4-down);
20+
// 弹窗容器与内容间距
21+
--tv-DialogBox-padding: var(--tv-space-xxxl);
2022
// 头部字号
2123
--tv-DialogBox-head-title-font-size: var(--tv-font-size-heading-md);
2224
// 头部字重

packages/theme/src/drawer/index.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120

121121
.@{drawer-prefix-cls}__header,
122122
.@{drawer-prefix-cls}__footer {
123-
margin-left: 32px;
124-
margin-right: 32px;
123+
margin-left: var(--tv-Drawer-padding);
124+
margin-right: var(--tv-Drawer-padding);
125125
}
126126

127127
.@{drawer-prefix-cls}__header-wrapper {
@@ -155,7 +155,7 @@
155155
}
156156

157157
.@{drawer-prefix-cls}__header {
158-
padding: 32px 0 24px;
158+
padding: var(--tv-Drawer-padding) 0 24px;
159159
background: var(--tv-Drawer-bg-color);
160160
display: flex;
161161
justify-content: space-between;
@@ -197,7 +197,7 @@
197197
.@{drawer-prefix-cls}__body {
198198
flex: auto;
199199
overflow: auto;
200-
padding: 0 32px;
200+
padding: 0 var(--tv-Drawer-padding);
201201
border-bottom: 1px solid var(--tv-Drawer-divider-body-border-color);
202202
}
203203

@@ -206,7 +206,7 @@
206206
display: flex;
207207
align-items: center;
208208
justify-content: flex-end;
209-
padding: 24px 0 32px;
209+
padding: 24px 0 var(--tv-Drawer-padding);
210210
}
211211
}
212212
}

packages/theme/src/drawer/vars.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
--tv-Drawer-max-width: 1000px;
1818
// 背景色
1919
--tv-Drawer-bg-color: var(--tv-color-bg-secondary);
20+
// 抽屉容器与内容间距
21+
--tv-Drawer-padding: var(--tv-space-xxxl);
2022
// 内容底部边框色
2123
--tv-Drawer-divider-body-border-color: var(--tv-color-border-divider);
2224
// 抽屉组件圆角

packages/theme/src/form-item/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
.@{form-item-prefix-cls} {
274274
display: inline-block;
275275
vertical-align: top;
276-
margin-right: 24px;
276+
margin-right: var(--tv-FormItem-inline-margin-right);
277277
}
278278

279279
.@{form-item-prefix-cls}__label {

0 commit comments

Comments
 (0)