commit c42024fbed4d679ba729f48673629d1c7aa77cf1 Author: zuiidea Date: Mon Jan 25 15:45:58 2016 +0800 ant-demo ant-demo diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7e3649a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..be511fe --- /dev/null +++ b/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-airbnb" +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce0665e --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*.iml +.idea/ +.ipr +.iws +*~ +~* +*.diff +*.patch +*.bak +.DS_Store +Thumbs.db +.project +.*proj +.svn/ +*.swp +*.swo +*.pyc +*.pyo +node_modules +dist diff --git a/README.md b/README.md new file mode 100644 index 0000000..82ad55e --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# antd-demo + +## Environment + +``` +node >= 4 +``` + +## Code Style + +https://github.com/airbnb/javascript + +## Develop + +``` +npm run dev +``` + +访问 http://127.0.0.1:8989 + +## Build + +``` +npm run build +``` diff --git a/index.html b/index.html new file mode 100644 index 0000000..bdb0c5d --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + + + +
+ + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..441239d --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "antd-demo", + "version": "1.0.0", + "entry": { + "index": "./src/entry/index.jsx" + }, + "dependencies": { + "antd": "0.11.x", + "atool-build": "0.4.x", + "babel-plugin-antd": "^0.1.2", + "es3ify-loader": "^0.1.0", + "react": "~0.14.3", + "react-dom": "~0.14.3" + }, + "devDependencies": { + "dora": "0.2.x", + "dora-plugin-atool-build": "0.4.x", + "dora-plugin-hmr": "0.3.x", + "dora-plugin-proxy": "0.5.x", + "eslint": "~1.10.3", + "eslint-config-airbnb": "~2.1.0", + "eslint-plugin-react": "~3.11.3", + "pre-commit": "1.x" + }, + "pre-commit": [ + "lint" + ], + "scripts": { + "dev": "dora -p 8001 --plugins atool-build,proxy,hmr", + "lint": "eslint --ext .js,.jsx src", + "build": "atool-build -o ./dist/${npm_package_family}/${npm_package_name/{npm_package_version}" + } +} diff --git a/src/common/lib.js b/src/common/lib.js new file mode 100644 index 0000000..19438ec --- /dev/null +++ b/src/common/lib.js @@ -0,0 +1 @@ +import 'antd/lib/index.css'; diff --git a/src/component/App.jsx b/src/component/App.jsx new file mode 100644 index 0000000..0762ecf --- /dev/null +++ b/src/component/App.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { DatePicker, message } from 'antd'; + +const App = React.createClass({ + getInitialState() { + return { + date: '' + }; + }, + handleChange(value) { + message.info('您选择的日期是: ' + value.toString()); + this.setState({ + date: value + }); + }, + render() { + return
+ +
当前日期:{this.state.date.toString()}
+
; + } +}); + +export default App; \ No newline at end of file diff --git a/src/entry/index.jsx b/src/entry/index.jsx new file mode 100644 index 0000000..f4e3585 --- /dev/null +++ b/src/entry/index.jsx @@ -0,0 +1,6 @@ +import '../common/lib'; +import App from '../component/App'; +import ReactDOM from 'react-dom'; +import React from 'react'; + +ReactDOM.render(, document.getElementById('react-content')); diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..16a1d16 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,17 @@ +module.exports = function(webpackConfig) { + webpackConfig.module.loaders.forEach(function(loader) { + if (loader.loader === 'babel') { + // https://github.com/ant-design/babel-plugin-antd + loader.query.plugins.push('antd'); + } + return loader; + }); + + // Fix ie8 compatibility + webpackConfig.module.loaders.unshift({ + test: /\.jsx?$/, + loader: 'es3ify', + }); + + return webpackConfig; +};