mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
feat: Button danger-link
This commit is contained in:
parent
4f23bbcdc6
commit
0e1998f643
@ -65,14 +65,14 @@ function spaceChildren(children: React.ReactNode, needInserted: boolean) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'danger', 'link');
|
const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'danger', 'link', 'danger-link');
|
||||||
export type ButtonType = (typeof ButtonTypes)[number];
|
export type ButtonType = typeof ButtonTypes[number];
|
||||||
const ButtonShapes = tuple('circle', 'circle-outline', 'round');
|
const ButtonShapes = tuple('circle', 'circle-outline', 'round');
|
||||||
export type ButtonShape = (typeof ButtonShapes)[number];
|
export type ButtonShape = typeof ButtonShapes[number];
|
||||||
const ButtonSizes = tuple('large', 'default', 'small');
|
const ButtonSizes = tuple('large', 'default', 'small');
|
||||||
export type ButtonSize = (typeof ButtonSizes)[number];
|
export type ButtonSize = typeof ButtonSizes[number];
|
||||||
const ButtonHTMLTypes = tuple('submit', 'button', 'reset');
|
const ButtonHTMLTypes = tuple('submit', 'button', 'reset');
|
||||||
export type ButtonHTMLType = (typeof ButtonHTMLTypes)[number];
|
export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
|
||||||
|
|
||||||
export interface BaseButtonProps {
|
export interface BaseButtonProps {
|
||||||
type?: ButtonType;
|
type?: ButtonType;
|
||||||
@ -296,7 +296,7 @@ class Button extends React.Component<ButtonProps, ButtonState> {
|
|||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (type === 'link') {
|
if (type === 'link' || type === 'danger-link') {
|
||||||
return buttonNode;
|
return buttonNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ ReactDOM.render(
|
|||||||
<Button type="dashed">Dashed</Button>
|
<Button type="dashed">Dashed</Button>
|
||||||
<Button type="danger">Danger</Button>
|
<Button type="danger">Danger</Button>
|
||||||
<Button type="link">Link</Button>
|
<Button type="link">Link</Button>
|
||||||
|
<Button type="danger-link">Link</Button>
|
||||||
</div>,
|
</div>,
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
|
@ -31,6 +31,9 @@ ReactDOM.render(
|
|||||||
<Button type="link" block>
|
<Button type="link" block>
|
||||||
Link
|
Link
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button type="danger-link" block>
|
||||||
|
Danger Link
|
||||||
|
</Button>
|
||||||
</div>,
|
</div>,
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
|
@ -35,6 +35,10 @@ ReactDOM.render(
|
|||||||
<Button type="link" disabled>
|
<Button type="link" disabled>
|
||||||
Link(disabled)
|
Link(disabled)
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button type="danger-link">Danger Link</Button>
|
||||||
|
<Button type="danger-link" disabled>
|
||||||
|
Danger Link(disabled)
|
||||||
|
</Button>
|
||||||
<div style={{ padding: '8px 8px 0 8px', background: 'rgb(190, 200, 200)' }}>
|
<div style={{ padding: '8px 8px 0 8px', background: 'rgb(190, 200, 200)' }}>
|
||||||
<Button ghost>Ghost</Button>
|
<Button ghost>Ghost</Button>
|
||||||
<Button ghost disabled>
|
<Button ghost disabled>
|
||||||
|
@ -28,6 +28,9 @@ ReactDOM.render(
|
|||||||
<Button type="link" ghost>
|
<Button type="link" ghost>
|
||||||
link
|
link
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button type="danger-link" ghost>
|
||||||
|
Danger Link
|
||||||
|
</Button>
|
||||||
</div>,
|
</div>,
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
|
@ -54,6 +54,9 @@ class ButtonSize extends React.Component {
|
|||||||
<Button type="link" size={size}>
|
<Button type="link" size={size}>
|
||||||
Link
|
Link
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button type="danger-link" size={size}>
|
||||||
|
Danger Link
|
||||||
|
</Button>
|
||||||
<br />
|
<br />
|
||||||
<Button type="primary" icon={<Download />} size={size} />
|
<Button type="primary" icon={<Download />} size={size} />
|
||||||
<Button type="primary" shape="circle" icon={<Download />} size={size} />
|
<Button type="primary" shape="circle" icon={<Download />} size={size} />
|
||||||
@ -64,17 +67,6 @@ class ButtonSize extends React.Component {
|
|||||||
<Button type="primary" icon={<Download />} size={size}>
|
<Button type="primary" icon={<Download />} size={size}>
|
||||||
Download
|
Download
|
||||||
</Button>
|
</Button>
|
||||||
<br />
|
|
||||||
<Button.Group size={size}>
|
|
||||||
<Button type="primary">
|
|
||||||
<Left />
|
|
||||||
Backward
|
|
||||||
</Button>
|
|
||||||
<Button type="primary">
|
|
||||||
Forward
|
|
||||||
<Right />
|
|
||||||
</Button>
|
|
||||||
</Button.Group>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,10 @@
|
|||||||
.btn-link;
|
.btn-link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-danger-link {
|
||||||
|
.btn-danger-link;
|
||||||
|
}
|
||||||
|
|
||||||
&-icon-only {
|
&-icon-only {
|
||||||
.btn-square(@btn-prefix-cls);
|
.btn-square(@btn-prefix-cls);
|
||||||
}
|
}
|
||||||
@ -175,6 +179,12 @@
|
|||||||
color: @component-background;
|
color: @component-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-background-ghost&-danger-link {
|
||||||
|
.button-variant-ghost(@error-color; transparent);
|
||||||
|
|
||||||
|
color: @component-background;
|
||||||
|
}
|
||||||
|
|
||||||
&-two-chinese-chars::first-letter {
|
&-two-chinese-chars::first-letter {
|
||||||
letter-spacing: 0.34em;
|
letter-spacing: 0.34em;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,19 @@
|
|||||||
}
|
}
|
||||||
.button-disabled(@disabled-color; transparent; transparent);
|
.button-disabled(@disabled-color; transparent; transparent);
|
||||||
}
|
}
|
||||||
|
// danger link button style
|
||||||
|
.btn-danger-link() {
|
||||||
|
.button-variant-other(@error-color, transparent, transparent);
|
||||||
|
box-shadow: none;
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
.button-color(~`colorPalette('@{error-color}', 5) `; transparent; transparent);
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
.button-color(~`colorPalette('@{error-color}', 7) `; transparent; transparent);
|
||||||
|
}
|
||||||
|
.button-disabled(@disabled-color; transparent; transparent);
|
||||||
|
}
|
||||||
// round button
|
// round button
|
||||||
.btn-round(@btnClassName: btn) {
|
.btn-round(@btnClassName: btn) {
|
||||||
.button-size(@btn-circle-size; 0 @btn-circle-size / 2; @font-size-base; @btn-circle-size);
|
.button-size(@btn-circle-size; 0 @btn-circle-size / 2; @font-size-base; @btn-circle-size);
|
||||||
|
Loading…
Reference in New Issue
Block a user