mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
Merge branch 'master' of github.com:ant-design/ant-design
This commit is contained in:
commit
7f3180d0ef
@ -9,8 +9,8 @@
|
||||
---
|
||||
|
||||
````html
|
||||
<button class="ant-btn ant-btn-default">Button</button>
|
||||
<a href="javascript:;" class="ant-btn ant-btn-default" role="button">Link</a>
|
||||
<input class="ant-btn ant-btn-default" type="button" value="Input" />
|
||||
<input class="ant-btn ant-btn-default" type="submit" value="Submit" />
|
||||
<button class="ant-btn">Button</button>
|
||||
<a href="javascript:;" class="ant-btn" role="button">Link</a>
|
||||
<input class="ant-btn" type="button" value="Input" />
|
||||
<input class="ant-btn" type="submit" value="Submit" />
|
||||
````
|
||||
|
@ -19,15 +19,15 @@
|
||||
<button class="ant-btn ant-btn-primary">取 消</button>
|
||||
</div>
|
||||
<div class="ant-btn-group">
|
||||
<button class="ant-btn ant-btn-default">左</button>
|
||||
<button class="ant-btn ant-btn-default">中</button>
|
||||
<button class="ant-btn ant-btn-default">右</button>
|
||||
<button class="ant-btn">左</button>
|
||||
<button class="ant-btn">中</button>
|
||||
<button class="ant-btn">右</button>
|
||||
</div>
|
||||
<div class="ant-btn-group">
|
||||
<button class="ant-btn ant-btn-primary">左</button>
|
||||
<button class="ant-btn ant-btn-ghost">中</button>
|
||||
<button class="ant-btn ant-btn-ghost">中</button>
|
||||
<button class="ant-btn ant-btn-default">右</button>
|
||||
<button class="ant-btn">右</button>
|
||||
</div>
|
||||
<h4>带图标按钮组合 </h4>
|
||||
<div class="ant-btn-group">
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Icon Button
|
||||
|
||||
- order: 4
|
||||
- order: 5
|
||||
|
||||
图标按钮
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
<button class="ant-btn ant-btn-ghost ant-btn-circle-outline">
|
||||
<span class="anticon anticon-search"></span>
|
||||
</button>
|
||||
<button class="ant-btn ant-btn-default ant-btn-circle-outline ant-btn-sm">
|
||||
<button class="ant-btn ant-btn-circle-outline ant-btn-sm">
|
||||
<span class="anticon anticon-search"></span>
|
||||
</button>
|
||||
````
|
@ -1,6 +1,6 @@
|
||||
# Loading Button
|
||||
|
||||
- order: 6
|
||||
- order: 7
|
||||
|
||||
加载按钮
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Menu Btutton
|
||||
|
||||
- order: 5
|
||||
- order: 6
|
||||
|
||||
菜单按钮
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Button sizes
|
||||
|
||||
- order: 7
|
||||
- order: 3
|
||||
|
||||
按钮尺寸
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Button Status
|
||||
|
||||
- order: 3
|
||||
- order: 4
|
||||
|
||||
通过背景色透明度的变化来体现不同的操作状态
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
<button class="ant-btn ant-btn-primary active">主按钮(激活)</button>
|
||||
<button class="ant-btn ant-btn-primary disabled">主按钮(失效)</button>
|
||||
<p></p>
|
||||
<button class="ant-btn ant-btn-default">次按钮</button>
|
||||
<button class="ant-btn ant-btn-default active">次按钮(激活)</button>
|
||||
<button class="ant-btn ant-btn-default disabled">次按钮(失效)</button>
|
||||
<button class="ant-btn">次按钮</button>
|
||||
<button class="ant-btn active">次按钮(激活)</button>
|
||||
<button class="ant-btn disabled">次按钮(失效)</button>
|
||||
<p></p>
|
||||
<button class="ant-btn ant-btn-ghost">幽灵按钮</button>
|
||||
<button class="ant-btn ant-btn-ghost active">幽灵按钮(激活)</button>
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
使用下面列出的类即可创建带有预定义样式的按钮,我们通过样式来显示重要程度的不同。
|
||||
|
||||
`ant-btn-primary`、`ant-btn-default`、`ant-btn-ghost`
|
||||
`ant-btn-primary`、`ant-btn`、`ant-btn-ghost`
|
||||
|
||||
其中 `ant-btn` 为按钮默认样式,语义上代表次按钮
|
||||
|
||||
**注**: 当按钮文字为两个字时,中间需要**间隔一个字符**。
|
||||
|
||||
@ -14,6 +16,6 @@
|
||||
|
||||
````html
|
||||
<button class="ant-btn ant-btn-primary">主按钮</button>
|
||||
<button class="ant-btn ant-btn-default">次按钮</button>
|
||||
<button class="ant-btn">次按钮</button>
|
||||
<button class="ant-btn ant-btn-ghost">幽灵按钮</button>
|
||||
````
|
||||
|
@ -21,7 +21,7 @@
|
||||
```
|
||||
.ant-btn
|
||||
↓
|
||||
.ant-btn-primary | .ant-btn-default | .ant-btn-ghost
|
||||
.ant-btn-primary | .ant-btn-ghost
|
||||
↓
|
||||
.ant-btn-circle | .ant-btn-circle-outline
|
||||
↓
|
||||
@ -32,8 +32,8 @@
|
||||
|
||||
| 类名 | 说明 |
|
||||
| ------------- | ------------- |
|
||||
| `.ant-btn` | 按钮基础样式, 用于初始化按钮 |
|
||||
| `.ant-btn-primary` `.ant-btn-default` `.ant-btn-ghost` | 使用这些列出的类可以快速创建一个带有预定义样式的按钮。 |
|
||||
| `.ant-btn` | 按钮基础样式 |
|
||||
| `.ant-btn-primary` `.ant-btn-ghost` | 使用这些列出的类可以快速创建一个带有预定义样式的按钮。 |
|
||||
| `.ant-btn-circle` `.ant-btn-circle-outline` | 用于创建圆形按钮,`.ant-btn-circle-outline` 为描边按钮 |
|
||||
| `.ant-btn-lg` `.ant-btn-sm` | 定义按钮大小尺寸, 目前提供三种尺寸:大中小,默认为中 |
|
||||
| `.ant-btn-group` | 按钮组合,通过按钮组容器把一组按钮放在同一行里 |
|
||||
|
@ -12,9 +12,7 @@ var confirm = antd.confirm;
|
||||
function showConfirm(){
|
||||
confirm({
|
||||
title: '第一个 confirm',
|
||||
content: 'confirm 内容',
|
||||
onOk: function() {},
|
||||
onCancel: function() {}
|
||||
content: 'confirm 内容'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var Dialog = require('rc-dialog');
|
||||
var div;
|
||||
@ -17,26 +19,38 @@ module.exports = function (props) {
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
if (props.onCancel) {
|
||||
props.onCancel(close);
|
||||
var cancelFn = props.onCancel;
|
||||
if (cancelFn) {
|
||||
if(cancelFn.length){
|
||||
cancelFn(close);
|
||||
}else {
|
||||
cancelFn();
|
||||
close();
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function onOk() {
|
||||
if (props.onOk) {
|
||||
props.onOk(close);
|
||||
var okFn = props.onOk;
|
||||
if (okFn) {
|
||||
if(okFn.length){
|
||||
okFn(close);
|
||||
}else {
|
||||
okFn();
|
||||
close();
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
var body = <div className="ant-confirm-body">
|
||||
<i className={"anticon " + props.iconClassName}></i>
|
||||
<i className={'anticon ' + props.iconClassName}></i>
|
||||
<span className="ant-confirm-title">{props.title}</span>
|
||||
<div className="ant-confirm-content">{props.content}</div>
|
||||
</div>
|
||||
</div>;
|
||||
var footer = <div className="ant-confirm-btns">
|
||||
<button type="button" className="ant-btn-default ant-btn ant-btn-lg" onClick={onCancel}>取 消</button>
|
||||
<button type="button" className="ant-btn-primary ant-btn ant-btn-lg" onClick={onOk}>确 定</button>
|
||||
@ -48,7 +62,7 @@ module.exports = function (props) {
|
||||
}
|
||||
|
||||
React.render(<Dialog className="ant-confirm" renderToBody={false} visible={true} closable={false} title="" animation="zoom" maskAnimation="fade" width={width}>
|
||||
<div style={{zoom:1,overflow:'hidden'}}>{body} {footer}</div>
|
||||
<div style={{zoom: 1, overflow: 'hidden'}}>{body} {footer}</div>
|
||||
|
||||
</Dialog>, div, function () {
|
||||
d = this;
|
||||
|
@ -2,18 +2,19 @@
|
||||
|
||||
var React = require('react');
|
||||
var Dialog = require('rc-dialog');
|
||||
function noop(){}
|
||||
function noop() {
|
||||
}
|
||||
|
||||
var Modal = React.createClass({
|
||||
handleCancel() {
|
||||
this.refs.d.requestClose();
|
||||
},
|
||||
|
||||
getDefaultProps(){
|
||||
getDefaultProps() {
|
||||
return {
|
||||
onOk:noop,
|
||||
onCancel:noop,
|
||||
onBeforeClose:noop
|
||||
onOk: noop,
|
||||
onCancel: noop,
|
||||
onBeforeClose: noop
|
||||
};
|
||||
},
|
||||
|
||||
@ -27,8 +28,8 @@ var Modal = React.createClass({
|
||||
<button type="button" className="ant-btn-default ant-btn" onClick={this.handleCancel}>取 消</button>,
|
||||
<button type="button" className="ant-btn-primary ant-btn" onClick={this.handleOk}>确 定</button>
|
||||
];
|
||||
return <Dialog animation="zoom" maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>
|
||||
return <Dialog animation="zoom" maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Modal;
|
||||
module.exports = Modal;
|
||||
|
2
index.js
2
index.js
@ -9,7 +9,7 @@ var antd = {
|
||||
Dropdown: require('./components/dropdown'),
|
||||
Progress: require('./components/progress'),
|
||||
Select: require('./components/select'),
|
||||
confirm:require('./components/confirm')
|
||||
confirm: require('./components/confirm')
|
||||
};
|
||||
|
||||
module.exports = window.antd = antd;
|
||||
|
@ -32,11 +32,13 @@
|
||||
"eslint-plugin-react": "~2.5.0",
|
||||
"extract-text-webpack-plugin": "~0.8.1",
|
||||
"gh-pages-cli": "~0.2.0",
|
||||
"jshint": "~2.8.0",
|
||||
"json-loader": "~0.5.1",
|
||||
"less": "~2.5.1",
|
||||
"less-loader": "~2.2.0",
|
||||
"lodash": "~3.8.0",
|
||||
"nico-jsx": "~0.5.8",
|
||||
"precommit-hook": "~1.0.7",
|
||||
"style-loader": "~0.12.2",
|
||||
"webpack": "~1.9.7"
|
||||
},
|
||||
@ -47,5 +49,8 @@
|
||||
"deploy": "npm run build && gh-pages -d _site -b gh-pages",
|
||||
"lint": "eslint components index.js --ext '.js,.jsx'",
|
||||
"test": "webpack && npm run lint"
|
||||
}
|
||||
},
|
||||
"precommit": [
|
||||
"lint"
|
||||
]
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
// -----------------------------
|
||||
.@{btnPrefixClass} {
|
||||
.btn;
|
||||
.btn-default;
|
||||
|
||||
&-primary {
|
||||
.btn-primary;
|
||||
@ -25,10 +26,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-default {
|
||||
.btn-default;
|
||||
}
|
||||
|
||||
&-ghost {
|
||||
.btn-ghost;
|
||||
}
|
||||
|
@ -29,7 +29,9 @@
|
||||
-webkit-user-select: none;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
|
||||
a {
|
||||
.@{prefixCalendarClass}-year-select,
|
||||
.@{prefixCalendarClass}-month-select {
|
||||
padding: 0px 2px;
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
color: #666;
|
||||
@ -39,16 +41,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.@{prefixCalendarClass}-year-select,
|
||||
.@{prefixCalendarClass}-month-select {
|
||||
padding: 0px 2px;
|
||||
}
|
||||
|
||||
> a {
|
||||
color: #999;
|
||||
font-family: Arial,"Hiragino Sans GB","Microsoft Yahei","Microsoft Sans Serif","WenQuanYi Micro Hei",sans-serif;
|
||||
padding: 0 5px;
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.@{prefixCalendarClass}-month-select-arrow {
|
||||
|
@ -133,15 +133,19 @@
|
||||
// primary button style
|
||||
.btn-primary() {
|
||||
.button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&.active {
|
||||
.button-color(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
|
||||
}
|
||||
}
|
||||
|
||||
// default button style
|
||||
.btn-default() {
|
||||
.button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
|
||||
|
||||
&:hover {
|
||||
.button-color(@primary-color; @white; @primary-color);
|
||||
}
|
||||
&:hover,
|
||||
&:active,
|
||||
&.active {
|
||||
.button-color(@primary-color; @white; @primary-color);
|
||||
@ -152,9 +156,7 @@
|
||||
.btn-ghost() {
|
||||
.button-variant(@btn-ghost-color, @btn-ghost-bg, @btn-ghost-border);
|
||||
|
||||
&:hover {
|
||||
.button-color(@primary-color; @white; @primary-color);
|
||||
}
|
||||
&:hover,
|
||||
&:active,
|
||||
&.active {
|
||||
.button-color(@primary-color; @white; @primary-color);
|
||||
|
Loading…
Reference in New Issue
Block a user