Browse Source
fix: #24614 text button style inconsistent in `danger` (#24622)
* fix: update button style when type="text" of danger
* update wording in danger button demo
* format code
pull/24641/head
Teng YANG
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
86 additions and
23 deletions
-
components/button/__tests__/__snapshots__/demo.test.ts.snap
-
components/button/demo/danger.md
-
components/button/demo/disabled.md
-
components/button/style/index.less
-
components/button/style/mixin.less
|
@ -109,12 +109,20 @@ Array [ |
|
|
Dashed |
|
|
Dashed |
|
|
</span> |
|
|
</span> |
|
|
</button>, |
|
|
</button>, |
|
|
|
|
|
<button |
|
|
|
|
|
class="ant-btn ant-btn-text ant-btn-dangerous" |
|
|
|
|
|
type="button" |
|
|
|
|
|
> |
|
|
|
|
|
<span> |
|
|
|
|
|
Text |
|
|
|
|
|
</span> |
|
|
|
|
|
</button>, |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
link |
|
|
Link |
|
|
</span> |
|
|
</span> |
|
|
</button>, |
|
|
</button>, |
|
|
] |
|
|
] |
|
@ -176,6 +184,24 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = ` |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
<button |
|
|
|
|
|
class="ant-btn ant-btn-text" |
|
|
|
|
|
type="button" |
|
|
|
|
|
> |
|
|
|
|
|
<span> |
|
|
|
|
|
Text |
|
|
|
|
|
</span> |
|
|
|
|
|
</button> |
|
|
|
|
|
<button |
|
|
|
|
|
class="ant-btn ant-btn-text" |
|
|
|
|
|
disabled="" |
|
|
|
|
|
type="button" |
|
|
|
|
|
> |
|
|
|
|
|
<span> |
|
|
|
|
|
Text(disabled) |
|
|
|
|
|
</span> |
|
|
|
|
|
</button> |
|
|
|
|
|
<br /> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-link" |
|
|
class="ant-btn ant-btn-link" |
|
|
type="button" |
|
|
type="button" |
|
@ -195,56 +221,56 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = ` |
|
|
</button> |
|
|
</button> |
|
|
<br /> |
|
|
<br /> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-text" |
|
|
class="ant-btn ant-btn-dangerous" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Text |
|
|
Danger Default |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-text" |
|
|
class="ant-btn ant-btn-dangerous" |
|
|
disabled="" |
|
|
disabled="" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Text(disabled) |
|
|
Danger Default(disabled) |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<br /> |
|
|
<br /> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
class="ant-btn ant-btn-text ant-btn-dangerous" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Danger Link |
|
|
Danger Text |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
class="ant-btn ant-btn-text ant-btn-dangerous" |
|
|
disabled="" |
|
|
disabled="" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Danger Link(disabled) |
|
|
Danger Text(disabled) |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<br /> |
|
|
<br /> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-dangerous" |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Danger Default |
|
|
Danger Link |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
class="ant-btn ant-btn-dangerous" |
|
|
class="ant-btn ant-btn-link ant-btn-dangerous" |
|
|
disabled="" |
|
|
disabled="" |
|
|
type="button" |
|
|
type="button" |
|
|
> |
|
|
> |
|
|
<span> |
|
|
<span> |
|
|
Danger Default(disabled) |
|
|
Danger Link(disabled) |
|
|
</span> |
|
|
</span> |
|
|
</button> |
|
|
</button> |
|
|
<div |
|
|
<div |
|
|
|
@ -25,8 +25,11 @@ ReactDOM.render( |
|
|
<Button type="dashed" danger> |
|
|
<Button type="dashed" danger> |
|
|
Dashed |
|
|
Dashed |
|
|
</Button> |
|
|
</Button> |
|
|
|
|
|
<Button type="text" danger> |
|
|
|
|
|
Text |
|
|
|
|
|
</Button> |
|
|
<Button type="link" danger> |
|
|
<Button type="link" danger> |
|
|
link |
|
|
Link |
|
|
</Button> |
|
|
</Button> |
|
|
</>, |
|
|
</>, |
|
|
mountNode, |
|
|
mountNode, |
|
|
|
@ -31,14 +31,26 @@ ReactDOM.render( |
|
|
Dashed(disabled) |
|
|
Dashed(disabled) |
|
|
</Button> |
|
|
</Button> |
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
<Button type="text">Text</Button> |
|
|
|
|
|
<Button type="text" disabled> |
|
|
|
|
|
Text(disabled) |
|
|
|
|
|
</Button> |
|
|
|
|
|
<br /> |
|
|
<Button type="link">Link</Button> |
|
|
<Button type="link">Link</Button> |
|
|
<Button type="link" disabled> |
|
|
<Button type="link" disabled> |
|
|
Link(disabled) |
|
|
Link(disabled) |
|
|
</Button> |
|
|
</Button> |
|
|
<br /> |
|
|
<br /> |
|
|
<Button type="text">Text</Button> |
|
|
<Button danger>Danger Default</Button> |
|
|
<Button type="text" disabled> |
|
|
<Button danger disabled> |
|
|
Text(disabled) |
|
|
Danger Default(disabled) |
|
|
|
|
|
</Button> |
|
|
|
|
|
<br /> |
|
|
|
|
|
<Button danger type="text"> |
|
|
|
|
|
Danger Text |
|
|
|
|
|
</Button> |
|
|
|
|
|
<Button danger type="text" disabled> |
|
|
|
|
|
Danger Text(disabled) |
|
|
</Button> |
|
|
</Button> |
|
|
<br /> |
|
|
<br /> |
|
|
<Button type="link" danger> |
|
|
<Button type="link" danger> |
|
@ -47,11 +59,6 @@ ReactDOM.render( |
|
|
<Button type="link" danger disabled> |
|
|
<Button type="link" danger disabled> |
|
|
Danger Link(disabled) |
|
|
Danger Link(disabled) |
|
|
</Button> |
|
|
</Button> |
|
|
<br /> |
|
|
|
|
|
<Button danger>Danger Default</Button> |
|
|
|
|
|
<Button danger disabled> |
|
|
|
|
|
Danger Default(disabled) |
|
|
|
|
|
</Button> |
|
|
|
|
|
<div className="site-button-ghost-wrapper"> |
|
|
<div className="site-button-ghost-wrapper"> |
|
|
<Button ghost>Ghost</Button> |
|
|
<Button ghost>Ghost</Button> |
|
|
<Button ghost disabled> |
|
|
<Button ghost disabled> |
|
|
|
@ -22,7 +22,7 @@ |
|
|
line-height: @line-height-base; |
|
|
line-height: @line-height-base; |
|
|
.btn; |
|
|
.btn; |
|
|
.btn-default; |
|
|
.btn-default; |
|
|
|
|
|
|
|
|
// Fix loading button animation |
|
|
// Fix loading button animation |
|
|
// https://github.com/ant-design/ant-design/issues/24323 |
|
|
// https://github.com/ant-design/ant-design/issues/24323 |
|
|
> span { |
|
|
> span { |
|
@ -95,6 +95,10 @@ |
|
|
.btn-danger-link; |
|
|
.btn-danger-link; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&-dangerous&-text { |
|
|
|
|
|
.btn-danger-text; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
&-icon-only { |
|
|
&-icon-only { |
|
|
.btn-square(@btn-prefix-cls); |
|
|
.btn-square(@btn-prefix-cls); |
|
|
vertical-align: -0.5px; |
|
|
vertical-align: -0.5px; |
|
|
|
@ -375,6 +375,29 @@ |
|
|
|
|
|
|
|
|
.button-disabled(@disabled-color; transparent; transparent); |
|
|
.button-disabled(@disabled-color; transparent; transparent); |
|
|
} |
|
|
} |
|
|
|
|
|
.btn-danger-text() { |
|
|
|
|
|
.button-variant-other(@error-color, transparent, transparent); |
|
|
|
|
|
box-shadow: none; |
|
|
|
|
|
&:hover, |
|
|
|
|
|
&:focus { |
|
|
|
|
|
& when (@theme = dark) { |
|
|
|
|
|
.button-color(~`colorPalette('@{error-color}', 7) `; @btn-text-hover-bg; transparent); |
|
|
|
|
|
} |
|
|
|
|
|
& when not (@theme = dark) { |
|
|
|
|
|
.button-color(~`colorPalette('@{error-color}', 5) `; @btn-text-hover-bg; transparent); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&:active { |
|
|
|
|
|
& when (@theme = dark) { |
|
|
|
|
|
.button-color(~`colorPalette('@{error-color}', 5) `; fadein(@btn-text-hover-bg, 1%); transparent); |
|
|
|
|
|
} |
|
|
|
|
|
& when not (@theme = dark) { |
|
|
|
|
|
.button-color(~`colorPalette('@{error-color}', 7) `; fadein(@btn-text-hover-bg, 1%); transparent); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
.button-disabled(@disabled-color; transparent; transparent); |
|
|
|
|
|
} |
|
|
// round button |
|
|
// round button |
|
|
.btn-round(@btnClassName: btn) { |
|
|
.btn-round(@btnClassName: btn) { |
|
|
.button-size(@btn-circle-size; @btn-circle-size / 2; @font-size-base; @btn-circle-size); |
|
|
.button-size(@btn-circle-size; @btn-circle-size / 2; @font-size-base; @btn-circle-size); |
|
|