feat(style): add component css variables

This commit is contained in:
chenjiahan
2021-06-12 15:52:22 +08:00
committed by neverland
parent dafea4e1e8
commit fe1cba97b7
73 changed files with 1702 additions and 799 deletions
+41 -19
View File
@@ -1,29 +1,51 @@
@import './var.less';
:root {
--van-dialog-width: @dialog-width;
--van-dialog-small-screen-width: @dialog-small-screen-width;
--van-dialog-font-size: @dialog-font-size;
--van-dialog-transition: @dialog-transition;
--van-dialog-border-radius: @dialog-border-radius;
--van-dialog-background-color: @dialog-background-color;
--van-dialog-header-font-weight: @dialog-header-font-weight;
--van-dialog-header-line-height: @dialog-header-line-height;
--van-dialog-header-padding-top: @dialog-header-padding-top;
--van-dialog-header-isolated-padding: @dialog-header-isolated-padding;
--van-dialog-message-padding: @dialog-message-padding;
--van-dialog-message-font-size: @dialog-message-font-size;
--van-dialog-message-line-height: @dialog-message-line-height;
--van-dialog-message-max-height: @dialog-message-max-height;
--van-dialog-has-title-message-text-color: @dialog-has-title-message-text-color;
--van-dialog-has-title-message-padding-top: @dialog-has-title-message-padding-top;
--van-dialog-button-height: @dialog-button-height;
--van-dialog-round-button-height: @dialog-round-button-height;
--van-dialog-confirm-button-text-color: @dialog-confirm-button-text-color;
}
.van-dialog {
top: 45%;
left: 50%;
width: @dialog-width;
width: var(--van-dialog-width);
overflow: hidden;
font-size: @dialog-font-size;
background-color: @dialog-background-color;
border-radius: @dialog-border-radius;
font-size: var(--van-dialog-font-size);
background-color: var(--van-dialog-background-color);
border-radius: var(--van-dialog-border-radius);
backface-visibility: hidden; // avoid blurry text after scale animation
transition: @dialog-transition;
transition: var(--van-dialog-transition);
transition-property: transform, opacity;
@media (max-width: 321px) {
width: @dialog-small-screen-width;
width: var(--van-dialog-small-screen-width);
}
&__header {
padding-top: @dialog-header-padding-top;
font-weight: @dialog-header-font-weight;
line-height: @dialog-header-line-height;
padding-top: var(--van-dialog-header-padding-top);
font-weight: var(--van-dialog-header-font-weight);
line-height: var(--van-dialog-header-line-height);
text-align: center;
&--isolated {
padding: @dialog-header-isolated-padding;
padding: var(--van-dialog-header-isolated-padding);
}
}
@@ -37,11 +59,11 @@
&__message {
flex: 1;
max-height: @dialog-message-max-height;
padding: 26px @dialog-message-padding;
max-height: var(--van-dialog-message-max-height);
padding: 26px var(--van-dialog-message-padding);
overflow-y: auto;
font-size: @dialog-message-font-size;
line-height: @dialog-message-line-height;
font-size: var(--van-dialog-message-font-size);
line-height: var(--van-dialog-message-line-height);
// allow newline charactor
white-space: pre-wrap;
@@ -50,8 +72,8 @@
-webkit-overflow-scrolling: touch;
&--has-title {
padding-top: @dialog-has-title-message-padding-top;
color: @dialog-has-title-message-text-color;
padding-top: var(--van-dialog-has-title-message-padding-top);
color: var(--van-dialog-has-title-message-text-color);
}
&--left {
@@ -72,7 +94,7 @@
&__confirm,
&__cancel {
flex: 1;
height: @dialog-button-height;
height: var(--van-dialog-button-height);
margin: 0;
border: 0;
}
@@ -80,7 +102,7 @@
&__confirm {
&,
&:active {
color: @dialog-confirm-button-text-color;
color: var(--van-dialog-confirm-button-text-color);
}
}
@@ -98,7 +120,7 @@
.van-dialog__confirm,
.van-dialog__cancel {
height: @dialog-round-button-height;
height: var(--van-dialog-round-button-height);
}
.van-dialog__confirm {