refactor(dialog): migrate css var (#2641)

This commit is contained in:
云游君 2021-07-23 23:12:45 +08:00 committed by GitHub
parent 7e3b9df2da
commit 4ae485123e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 36 deletions

View File

@ -185,11 +185,6 @@ $--font-size: map.merge(
$--font-size $--font-size
); );
/// fontWeight|1|Font Weight|1
$--font-weight-primary: 500 !default;
/// fontLineHeight|1|Line Height|2
$--font-line-height-primary: 24px !default;
/* Disable base /* Disable base
-------------------------- */ -------------------------- */
$--disabled-fill-base: $--background-color-base !default; $--disabled-fill-base: $--background-color-base !default;
@ -207,8 +202,6 @@ $--disabled-border-base: map.get($--border-color, 'light') !default;
-------------------------- */ -------------------------- */
/// fontSize||Font|1 /// fontSize||Font|1
$--radio-font-size: map.get($--font-size, 'base') !default; $--radio-font-size: map.get($--font-size, 'base') !default;
/// fontWeight||Font|1
$--radio-font-weight: $--font-weight-primary !default;
/// color||Color|0 /// color||Color|0
$--radio-font-color: $--color-text-regular !default; $--radio-font-color: $--color-text-regular !default;
$--radio-input-height: 14px !default; $--radio-input-height: 14px !default;
@ -431,16 +424,8 @@ $--button-active-shade-percent: 10% !default;
/* Dialog /* Dialog
-------------------------- */ -------------------------- */
$--dialog-background-color: $--color-white !default; // refactor with css3 var
$--dialog-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !default; // See packages/theme-chalk/src/dialog.scss
/// fontSize||Font|1
$--dialog-title-font-size: map.get($--font-size, 'large') !default;
/// fontSize||Font|1
$--dialog-content-font-size: 14px !default;
/// fontLineHeight||LineHeight|2
$--dialog-font-line-height: $--font-line-height-primary !default;
/// padding||Spacing|3
$--dialog-padding-primary: 20px !default;
/* Table /* Table
-------------------------- */ -------------------------- */

View File

@ -4,12 +4,21 @@
@import 'common/popup'; @import 'common/popup';
@import './overlay.scss'; @import './overlay.scss';
:root {
--el-dialog-background-color: var(--el-color-white);
--el-dialog-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
--el-dialog-title-font-size: var(--el-font-size-large);
--el-dialog-content-font-size: 14px;
--el-dialog-font-line-height: var(--el-font-line-height-primary);
--el-dialog-padding-primary: 20px;
}
@include b(dialog) { @include b(dialog) {
position: relative; position: relative;
margin: 0 auto 50px; margin: 0 auto 50px;
background: $--dialog-background-color; background: var(--el-dialog-background-color);
border-radius: $--border-radius-small; border-radius: var(--el-border-radius-small);
box-shadow: $--dialog-box-shadow; box-shadow: var(--el-dialog-box-shadow);
box-sizing: border-box; box-sizing: border-box;
width: 50%; width: 50%;
@ -32,14 +41,14 @@
} }
@include e(header) { @include e(header) {
padding: $--dialog-padding-primary; padding: var(--el-dialog-padding-primary);
padding-bottom: 10px; padding-bottom: 10px;
} }
@include e(headerbtn) { @include e(headerbtn) {
position: absolute; position: absolute;
top: $--dialog-padding-primary; top: var(--el-dialog-padding-primary);
right: $--dialog-padding-primary; right: var(--el-dialog-padding-primary);
padding: 0; padding: 0;
background: transparent; background: transparent;
border: none; border: none;
@ -60,20 +69,21 @@
} }
@include e(title) { @include e(title) {
line-height: $--dialog-font-line-height; line-height: var(--el-dialog-font-line-height);
font-size: $--dialog-title-font-size; font-size: var(--el-dialog-title-font-size);
color: $--color-text-primary; color: var(--el-color-text-primary);
} }
@include e(body) { @include e(body) {
padding: ($--dialog-padding-primary + 10px) $--dialog-padding-primary; padding: calc(var(--el-dialog-padding-primary) + 10px)
color: $--color-text-regular; var(--el-dialog-padding-primary);
font-size: $--dialog-content-font-size; color: var(--el-color-text-regular);
font-size: var(--el-dialog-content-font-size);
word-break: break-all; word-break: break-all;
} }
@include e(footer) { @include e(footer) {
padding: $--dialog-padding-primary; padding: var(--el-dialog-padding-primary);
padding-top: 10px; padding-top: 10px;
text-align: right; text-align: right;
box-sizing: border-box; box-sizing: border-box;
@ -85,7 +95,7 @@
@include e(body) { @include e(body) {
text-align: initial; text-align: initial;
padding: 25px ($--dialog-padding-primary + 5px) 30px; padding: 25px calc(var(--el-dialog-padding-primary) + 5px) 30px;
} }
@include e(footer) { @include e(footer) {

View File

@ -71,10 +71,18 @@
$directions: rtl, ltr, ttb, btt; $directions: rtl, ltr, ttb, btt;
:root {
--el-drawer-background-color: var(
--el-dialog-background-color,
var(--el-color-white)
);
--el-drawer-padding-primary: var(--el-dialog-padding-primary, 20px);
}
@include b(drawer) { @include b(drawer) {
position: absolute; position: absolute;
box-sizing: border-box; box-sizing: border-box;
background-color: $--dialog-background-color; background-color: var(--el-drawer-background-color);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2), box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2),
@ -96,7 +104,7 @@ $directions: rtl, ltr, ttb, btt;
color: rgb(114, 118, 123); color: rgb(114, 118, 123);
display: flex; display: flex;
margin-bottom: 32px; margin-bottom: 32px;
padding: $--dialog-padding-primary; padding: var(--el-dialog-padding-primary);
padding-bottom: 0; padding-bottom: 0;
& > :first-child { & > :first-child {
flex: 1; flex: 1;

View File

@ -5,9 +5,13 @@
@import 'mixins/button'; @import 'mixins/button';
@import 'common/var'; @import 'common/var';
:root {
--el-radio-font-weight: var(--el-font-weight-primary);
}
@include b(radio) { @include b(radio) {
color: $--radio-font-color; color: $--radio-font-color;
font-weight: $--radio-font-weight; font-weight: var(--el-radio-font-weight);
line-height: 1; line-height: 1;
position: relative; position: relative;
cursor: pointer; cursor: pointer;

View File

@ -62,8 +62,8 @@
@include set-css-var-type('font-size', $type, $--font-size); @include set-css-var-type('font-size', $type, $--font-size);
} }
--el-font-weight-primary: #{$--font-weight-primary}; --el-font-weight-primary: 500;
--el-line-height-primary: #{$--font-line-height-primary}; --el-font-line-height-primary: 24px;
--el-font-color-disabled-base: #bbb; --el-font-color-disabled-base: #bbb;
// z-index // z-index