diff --git a/components/button/demo/basic.md b/components/button/demo/basic.md index 8d1718392f8a68196bbdaf521ac1428bc4e8dfca..895453729fdeb8d68b1a1f2503b833f87164edef 100644 --- a/components/button/demo/basic.md +++ b/components/button/demo/basic.md @@ -1,9 +1,9 @@ # 基本型 -- description: 你说什么我听不清。 +- description: 标准的按钮 --- ````html - + ```` diff --git a/components/datepicker/demo/select.md b/components/datepicker/demo/select.md new file mode 100644 index 0000000000000000000000000000000000000000..927ecc759bfaf4ab557ca31e1d0f8e42c609988d --- /dev/null +++ b/components/datepicker/demo/select.md @@ -0,0 +1,23 @@ +# 基本 + +- description: 选择日期的回调 + +--- + +````jsx +var Datepicker = antd.datepicker; + +var Picker = React.createClass({ + handleChange: function(value) { + console.log(new Date(value.getTime())); + }, + render: function() { + return + } +}); + +React.render( + +, document.getElementById('components-datepicker-demo-select')); +```` + diff --git a/components/datepicker/index.jsx b/components/datepicker/index.jsx index 9b7ce27f3d93db0219ff6e2e4e446a18cb16f2a5..a18c237a01762b04e96b74cfa72499feab01c221 100644 --- a/components/datepicker/index.jsx +++ b/components/datepicker/index.jsx @@ -12,8 +12,6 @@ module.exports = React.createClass({ var value = new GregorianCalendar(zhCn); value.setTime(Date.now()); return { - time: Date.now(), - showTime: true, value: value }; }, @@ -22,6 +20,17 @@ module.exports = React.createClass({ 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 () { var state = this.state; var formatter = new DateTimeFormat(this.props.format); @@ -29,13 +38,14 @@ module.exports = React.createClass({ + showClear={true} /> ); return ( } formatter={formatter} calendar={calendar} - value={this.state.value} onChange={this.handleChange}> - + value={this.state.value} onChange={this.props.onSelect}> + ); } diff --git a/index.js b/index.js index 80d4be398fd4ed7ceb5047591acd494d541e85b0..e380ef9727ace58006896b81ecd8ec88dc7bb547 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +require('rc-style/dist/index.css'); + var antd = { datepicker: require('./components/datepicker') }; diff --git a/nico.js b/nico.js index b51c1be9c712c01b9841a7f1b59715295e2d5da6..d8cd9ede964d0a11a054131804e200f7bb17b6cf 100644 --- a/nico.js +++ b/nico.js @@ -1,6 +1,4 @@ var path = require('path'); -var webpackMiddleware = require("webpack-dev-middleware"); -var webpack = require('webpack'); // {{ settings for nico exports.site = { @@ -28,29 +26,4 @@ exports.writers = [ 'nico-jsx.StaticWriter', '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 }} diff --git a/package.json b/package.json index 688abede0aaa08f6267aea07fbb2f99414e971e8..c1704f091c433a17a03729077b169eaeb31ae9bc 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,11 @@ "dependencies": { "gregorian-calendar": "~3.0.0", "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": { + "concurrently": "~0.1.0", "css-loader": "~0.13.1", "gh-pages-cli": "~0.2.0", "json-loader": "~0.5.1", @@ -23,12 +25,11 @@ "lodash": "~3.8.0", "nico-jsx": "~0.5.3", "style-loader": "~0.12.2", - "webpack": "~1.9.7", - "webpack-dev-middleware": "~1.0.11" + "webpack": "~1.9.7" }, "scripts": { - "build": "npm run clean && nico build", - "start": "npm run clean && nico server --watch", + "build": "npm run clean && webpack && nico build", + "start": "npm run clean && concurrent --kill-others 'webpack -w' 'nico server --watch'", "clean": "rm -rf _site", "deploy": "npm run build && gh-pages -d _site -b master" } diff --git a/static/script.js b/static/script.js index 3c5267d7beff49c9381855f7935bb527c34bf795..de5d72a0b7413eb66bd690f27dd82c586ecd899e 100644 --- a/static/script.js +++ b/static/script.js @@ -16,62 +16,4 @@ $(function() { $(item).find('.highlight').slideToggle(150); 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() }); diff --git a/static/style.css b/static/style.css index 219358797510aa98660154157abeb228334a4583..96b930d6b1ccd82b2f98e0def8c158c92a2b00bd 100644 --- a/static/style.css +++ b/static/style.css @@ -1,8 +1,33 @@ +@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 { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + html, body { height: 100%; } @@ -153,7 +178,7 @@ header { border-top: 3px solid transparent; } .nav ul li.current { - /*border-top: 3px solid #71B5DE;*/ + border-top: 3px solid #71B5DE; } .nav ul li a { color: #728AA3; @@ -1045,7 +1070,7 @@ footer ul li > a { } .code-box-title:before { - font-family: iconfont; + font-family: iconfont-home; content: "\e607"; font-size: 16px; vertical-align: middle; diff --git a/theme/templates/code.html b/theme/templates/code.html index 87e1d7513194a19ca874e4b827d93f06607193d0..6bf1ba25f9915040071473dce89f4a499bc4f024 100644 --- a/theme/templates/code.html +++ b/theme/templates/code.html @@ -8,6 +8,6 @@

{{ post.meta.description }}

- + diff --git a/theme/templates/layout.html b/theme/templates/layout.html index e8bfe3db2d958cae9ecf8f628e272d494e79fd58..901bbf33b9fa5ab0a77c233b6abeaaddc05479cd 100644 --- a/theme/templates/layout.html +++ b/theme/templates/layout.html @@ -9,7 +9,6 @@ {% block title %}Ant Design{% endblock %} - @@ -31,7 +30,6 @@