refactor: Reduce Button CSS size (#24996)

* refactor: reduce button css size

* refactor: remove redundant button .less code
This commit is contained in:
07akioni 2020-06-15 16:00:15 +08:00 committed by GitHub
parent fe454d50bb
commit 520fbca0f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,14 +12,11 @@
}
.button-disabled(@color: @btn-disable-color; @background: @btn-disable-bg; @border: @btn-disable-border) {
&-disabled,
&.disabled,
&[disabled] {
&,
&:hover,
&:focus,
&:active,
&.active {
&:active {
.button-color(@color; @background; @border);
text-shadow: none;
@ -48,8 +45,7 @@
}
}
&:active,
&.active {
&:active {
& when (@theme = dark) {
.button-color(
@color; ~`colorPalette('@{background}', 5) `; ~`colorPalette('@{background}', 5) `
@ -80,8 +76,7 @@
);
}
}
&:active,
&.active {
&:active {
& when (@theme = dark) {
.button-color(@primary-7; @background; @primary-7);
}
@ -120,8 +115,7 @@
}
}
}
&:active,
&.active {
&:active {
& when (@border = transparent) {
& when (@theme = dark) {
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
@ -171,11 +165,10 @@
position: relative;
&:hover,
&:focus,
&:active,
&.active {
&:active {
z-index: 2;
}
&:disabled {
&[disabled] {
z-index: 0;
}
}
@ -238,7 +231,6 @@
outline: 0;
box-shadow: none;
}
&.disabled,
&[disabled] {
cursor: not-allowed;
> * {
@ -265,8 +257,7 @@
.button-variant-other(@btn-default-color; @btn-default-bg; @btn-default-border);
&:hover,
&:focus,
&:active,
&.active {
&:active {
text-decoration: none;
background: @btn-default-bg;
}
@ -302,8 +293,7 @@
);
}
}
&:active,
&.active {
&:active {
& when (@theme = dark) {
.button-color(
~`colorPalette('@{error-color}', 5) `; @btn-default-bg; ~`colorPalette('@{error-color}', 5)
@ -356,7 +346,7 @@
}
.button-disabled(@disabled-color; transparent; transparent);
}
// link button style
// text button style
.btn-text() {
.button-variant-other(@text-color, transparent, transparent);
box-shadow: none;