提交 b88043f3 编写于 作者: 罗宪

Merge branch 'dev' of https://github.com/ant-design/ant-design.github.io into dev

Conflicts:
	theme/templates/layout.html
# 基本型 # 基本型
- description: 你说什么我听不清。 - description: 标准的按钮
--- ---
````html ````html
<button>按钮</button> <button class="nd-btn">按钮</button>
```` ````
# 基本
- description: 选择日期的回调
---
````jsx
var Datepicker = antd.datepicker;
var Picker = React.createClass({
handleChange: function(value) {
console.log(new Date(value.getTime()));
},
render: function() {
return <Datepicker onSelect={this.handleChange} />
}
});
React.render(
<Picker />
, document.getElementById('components-datepicker-demo-select'));
````
...@@ -12,8 +12,6 @@ module.exports = React.createClass({ ...@@ -12,8 +12,6 @@ module.exports = React.createClass({
var value = new GregorianCalendar(zhCn); var value = new GregorianCalendar(zhCn);
value.setTime(Date.now()); value.setTime(Date.now());
return { return {
time: Date.now(),
showTime: true,
value: value value: value
}; };
}, },
...@@ -22,6 +20,17 @@ module.exports = React.createClass({ ...@@ -22,6 +20,17 @@ module.exports = React.createClass({
format: 'yyyy-MM-dd' format: 'yyyy-MM-dd'
}; };
}, },
componentDidMount: function () {
if (this.props.value) {
var value = new GregorianCalendar(zhCn);
value.setTime(new Date(this.props.value));
this.setState({value: value});
}
},
handleChange: function() {
var props = this.props;
this.props.onSelect(new Date(this.state.value.getTime()));
},
render: function () { render: function () {
var state = this.state; var state = this.state;
var formatter = new DateTimeFormat(this.props.format); var formatter = new DateTimeFormat(this.props.format);
...@@ -29,13 +38,14 @@ module.exports = React.createClass({ ...@@ -29,13 +38,14 @@ module.exports = React.createClass({
<Calendar <Calendar
locale={CalendarLocale} locale={CalendarLocale}
orient={['top', 'left']} orient={['top', 'left']}
showTime={this.state.showTime} showClear={true} /> showClear={true} />
); );
return ( return (
<DatePicker <DatePicker
trigger={<span className="rc-calendar-picker-icon" />}
formatter={formatter} calendar={calendar} formatter={formatter} calendar={calendar}
value={this.state.value} onChange={this.handleChange}> value={this.state.value} onChange={this.props.onSelect}>
<input type="text" className="datepicker-input" /> <input className="rc-calendar-picker-input" />
</DatePicker> </DatePicker>
); );
} }
......
require('rc-style/dist/index.css');
var antd = { var antd = {
datepicker: require('./components/datepicker') datepicker: require('./components/datepicker')
}; };
......
var path = require('path'); var path = require('path');
var webpackMiddleware = require("webpack-dev-middleware");
var webpack = require('webpack');
// {{ settings for nico // {{ settings for nico
exports.site = { exports.site = {
...@@ -28,29 +26,4 @@ exports.writers = [ ...@@ -28,29 +26,4 @@ exports.writers = [
'nico-jsx.StaticWriter', 'nico-jsx.StaticWriter',
'nico-jsx.FileWriter' 'nico-jsx.FileWriter'
]; ];
exports.middlewares = [{
name: 'webpack',
filter: /index\.js/,
handle: webpackMiddleware(webpack(require('./webpack.config')), {
// all options optional
noInfo: false,
// display no info to console (only warnings and errors)
watchDelay: 300,
// delay after change (only lazy: false)
publicPath: "/dist/",
// public path to bind the middleware to
// use the same as in webpack
headers: { "X-Custom-Header": "yes" },
// custom headers
stats: {
colors: true
}
// options for formating the statistics
})
}];
// end settings }} // end settings }}
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
"dependencies": { "dependencies": {
"gregorian-calendar": "~3.0.0", "gregorian-calendar": "~3.0.0",
"gregorian-calendar-format": "~3.0.1", "gregorian-calendar-format": "~3.0.1",
"rc-calendar": "~3.3.0" "rc-calendar": "~3.4.2",
"rc-style": "git@github.com:react-component/style.git"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "~0.1.0",
"css-loader": "~0.13.1", "css-loader": "~0.13.1",
"gh-pages-cli": "~0.2.0", "gh-pages-cli": "~0.2.0",
"json-loader": "~0.5.1", "json-loader": "~0.5.1",
...@@ -23,12 +25,11 @@ ...@@ -23,12 +25,11 @@
"lodash": "~3.8.0", "lodash": "~3.8.0",
"nico-jsx": "~0.5.3", "nico-jsx": "~0.5.3",
"style-loader": "~0.12.2", "style-loader": "~0.12.2",
"webpack": "~1.9.7", "webpack": "~1.9.7"
"webpack-dev-middleware": "~1.0.11"
}, },
"scripts": { "scripts": {
"build": "npm run clean && nico build", "build": "npm run clean && webpack && nico build",
"start": "npm run clean && nico server --watch", "start": "npm run clean && concurrent --kill-others 'webpack -w' 'nico server --watch'",
"clean": "rm -rf _site", "clean": "rm -rf _site",
"deploy": "npm run build && gh-pages -d _site -b master" "deploy": "npm run build && gh-pages -d _site -b master"
} }
......
...@@ -16,62 +16,4 @@ $(function() { ...@@ -16,62 +16,4 @@ $(function() {
$(item).find('.highlight').slideToggle(150); $(item).find('.highlight').slideToggle(150);
item.toggleClass('code-box-expand'); item.toggleClass('code-box-expand');
} }
var navFunc={
navStrArr: [],
init:function (){
var self=this;
self.navBox = $(".nav");
self.navBar = self.navBox.find(".bar");
self.navList = self.navBox.find("ul li");
self.navNum=$(".current").index();
self.search($(".search"));
self.navBarAnim();
self.navResize(null);
$(window).bind("resize", self.navResize);
},
navResize: function (e) {
var self = navFunc;
self.navBar.css("left", self.navList.width() * self.navNum)//.addClass("barAnim");
self.navList.eq(self.navNum).find("a").addClass("hover");
},
search: function (c) {
var self = this;
self.searchBox = c;
self.searchInput = self.searchBox.find("input[type='text']");
self.searchBtn = self.searchBox.find("button");
self.searchInput.focus(function (e) {
$(this).addClass("focus");
self.searchBtn.css("left", self.searchBox.width() + 13);
});
self.searchInput.blur(function (e) {
if (!self.searchInput.val()) {
self.searchBtn.attr("style", "");
$(this).removeClass("focus");
}
});
self.searchBtn.click(function (e) {
self.searchBox.find("form").submit();
})
},
navBarAnim: function () {
var self = this,delay;
function startBarAnim(num) {
self.navBar.css("left", self.navList.width() * num);
self.navList.eq(num).find("a").addClass("hover");
}
self.navList.bind("mouseenter", function (e) {
clearTimeout(delay);
var m = e.currentTarget;
self.navList.find("a").removeClass("hover");
self.navBar.addClass("barAnim").css("left", $(m).width() * $(m).index())
});
self.navList.bind("mouseleave", function (e) {
delay = setTimeout(function () {
startBarAnim(self.navNum)
}, 500);
});
}
};
navFunc.init()
}); });
@font-face {font-family: "iconfont-home";
src: url('//at.alicdn.com/t/font_1431765342_6775353.eot'); /* IE9*/
src: url('//at.alicdn.com/t/font_1431765342_6775353.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('//at.alicdn.com/t/font_1431765342_6775353.woff') format('woff'), /* chrome銆乫irefox */
url('//at.alicdn.com/t/font_1431765342_6775353.ttf') format('truetype'), /* chrome銆乫irefox銆乷pera銆丼afari, Android, iOS 4.2+*/
url('//at.alicdn.com/t/font_1431765342_6775353.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont-home {
font-family:"iconfont-home" !important;
font-size:16px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.icon-tag:before { content: "\e607"; }
.icon-lego:before { content: "\e600"; }
.icon-all:before { content: "\e601"; }
.icon-chevron:before { content: "\e602"; }
.icon-externallink:before { content: "\e603"; }
.icon-download:before { content: "\e604"; }
.icon-github:before { content: "\e605"; }
.icon-code:before { content: "\e606"; }
html { html {
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
html, body { html, body {
height: 100%; height: 100%;
} }
...@@ -153,7 +178,7 @@ header { ...@@ -153,7 +178,7 @@ header {
border-top: 3px solid transparent; border-top: 3px solid transparent;
} }
.nav ul li.current { .nav ul li.current {
/*border-top: 3px solid #71B5DE;*/ border-top: 3px solid #71B5DE;
} }
.nav ul li a { .nav ul li a {
color: #728AA3; color: #728AA3;
...@@ -1045,7 +1070,7 @@ footer ul li > a { ...@@ -1045,7 +1070,7 @@ footer ul li > a {
} }
.code-box-title:before { .code-box-title:before {
font-family: iconfont; font-family: iconfont-home;
content: "\e607"; content: "\e607";
font-size: 16px; font-size: 16px;
vertical-align: middle; vertical-align: middle;
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<p class="code-box-description"> <p class="code-box-description">
{{ post.meta.description }} {{ post.meta.description }}
</p> </p>
<span class="collapse iconfont icon-chevron"></span> <span class="collapse iconfont-home icon-chevron"></span>
</div> </div>
</div> </div>
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<title>{% block title %}Ant Design{% endblock %}</title> <title>{% block title %}Ant Design{% endblock %}</title>
<link rel="stylesheet" href="/static/normalize.css"> <link rel="stylesheet" href="/static/normalize.css">
<link rel="stylesheet" href="/static/style.css"> <link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_1431765342_9023364.css">
<link href="http://fonts.useso.com/css?family=Raleway:600,500,400,300" rel="stylesheet" type="text/css"> <link href="http://fonts.useso.com/css?family=Raleway:600,500,400,300" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/static/tomorrow.css"> <link rel="stylesheet" href="/static/tomorrow.css">
<script src="https://a.alipayobjects.com/jquery/jquery/1.11.1/jquery.js"></script> <script src="https://a.alipayobjects.com/jquery/jquery/1.11.1/jquery.js"></script>
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
</form> </form>
</div> </div>
<nav class="nav"> <nav class="nav">
<span class="bar"></span>
<ul> <ul>
<li class="{%- if post.meta.filepath === 'README.md' %}current{%- endif %}"> <li class="{%- if post.meta.filepath === 'README.md' %}current{%- endif %}">
<a href="/">首页</a> <a href="/">首页</a>
...@@ -61,7 +59,6 @@ ...@@ -61,7 +59,6 @@
{%- if post.filepath === 'README.md' %} {%- if post.filepath === 'README.md' %}
<!-- 首页 --> <!-- 首页 -->
<div class="main"> <div class="main">
<div class="main-box" id="main"> <div class="main-box" id="main">
<div class="banner-box"> <div class="banner-box">
<div id="bannerAnim"></div> <div id="bannerAnim"></div>
...@@ -96,7 +93,7 @@ ...@@ -96,7 +93,7 @@
{{ post.title }} {{ post.meta.chinese }} {{ post.title }} {{ post.meta.chinese }}
{%- if post.meta.API %} {%- if post.meta.API %}
<a class="api-link" href="http://{{ post.meta.API }}" target="_blank"> <a class="api-link" href="http://{{ post.meta.API }}" target="_blank">
<i class="iconfont icon-externallink"></i> <i class="iconfont-home icon-externallink"></i>
API 使用说明 API 使用说明
</a> </a>
{%- endif %} {%- endif %}
...@@ -105,7 +102,7 @@ ...@@ -105,7 +102,7 @@
{%- if post.meta.template === 'component' %} {%- if post.meta.template === 'component' %}
<h2 class="component-demos"> <h2 class="component-demos">
组件演示 组件演示
<i class="iconfont icon-all" title="展开全部代码"></i> <i class="iconfont-home icon-all" title="展开全部代码"></i>
</h2> </h2>
<div class="code-boxes waterfall" data-col-min-width="400" <div class="code-boxes waterfall" data-col-min-width="400"
data-default-container-width="800" data-default-container-width="800"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册