diff --git a/.eslintrc.js b/.eslintrc.js
index ca78754aa..3bd135b65 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,47 +1,7 @@
module.exports = {
- "env": {
- "browser": true,
- "commonjs": true,
- "es6": true
- },
- "parser": "babel-eslint",
- "extends": "airbnb",
- plugins: [
- 'react'
- ],
- "rules": {
- "indent": [
- 2,
- 4,
- {"VariableDeclarator": 1}
- ],
- "import/prefer-default-export": 0,
- "keyword-spacing": 2,
- "no-unused-expressions": 0,
- "react/no-string-refs": 0,
+ "extends": "impression",
+ rules: {
"react/jsx-indent-props": [2, 4],
"react/jsx-indent": [2, 4],
- "react/jsx-filename-extension": [2, { extensions: ['.js'] }],
- "react/jsx-closing-bracket-location": 0,
- "react/sort-comp": 0,
- "react/no-find-dom-node": 0,
- "jsx-a11y/img-has-alt": 0,
- "jsx-a11y/label-has-for": 0,
- "arrow-body-style": 0,
- "space-before-function-paren": 0,
- "keyword-spacing": 0,
- "no-mixed-operators": 0,
- "no-underscore-dangle": 0,
- "one-var": [
- 1,
- "always"
- ],
- "no-shadow": 0,
- "no-param-reassign": 0,
- "prefer-const": 0,
- "no-prototype-builtins": 0,
- "no-script-url": 0,
- "global-require": 0,
- "max-len": [2, {"code" : 120}]
}
};
diff --git a/todo.TODO b/impression.todo
similarity index 100%
rename from todo.TODO
rename to impression.todo
diff --git a/package.json b/package.json
index fd7cab003..2ac315c80 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "impression-react",
- "version": "0.4.3",
+ "version": "0.4.4",
"author": "peter.shenlq",
"description": "An enterprise-class UI design language and React-based implementation.",
"main": "./lib/index.js",
@@ -45,6 +45,7 @@
"babel-preset-stage-0": "^6.5.0",
"eslint": "^3.4.0",
"eslint-config-airbnb": "^10.0.1",
+ "eslint-config-impression": "^1.0.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-flow-vars": "^0.3.0",
"eslint-plugin-import": "^1.14.0",
diff --git a/site/.eslintrc.js b/site/.eslintrc.js
index afd9234e4..3bd135b65 100644
--- a/site/.eslintrc.js
+++ b/site/.eslintrc.js
@@ -1,48 +1,7 @@
module.exports = {
- "env": {
- "browser": true,
- "commonjs": true,
- "es6": true
- },
- "parser": "babel-eslint",
- "extends": "airbnb",
- plugins: [
- 'react'
- ],
- "rules": {
- "indent": [
- 2,
- 4,
- {"VariableDeclarator": 1}
- ],
- "import/prefer-default-export": 0,
- "keyword-spacing": 2,
- "no-unused-expressions": 0,
- "react/no-string-refs": 0,
+ "extends": "impression",
+ rules: {
"react/jsx-indent-props": [2, 4],
"react/jsx-indent": [2, 4],
- "react/jsx-filename-extension": [2, { extensions: ['.js'] }],
- "react/jsx-closing-bracket-location": 0,
- "react/sort-comp": 0,
- "react/no-find-dom-node": 0,
- "jsx-a11y/img-has-alt": 0,
- "jsx-a11y/label-has-for": 0,
- "arrow-body-style": 0,
- "space-before-function-paren": 0,
- "keyword-spacing": 0,
- "no-mixed-operators": 0,
- "no-underscore-dangle": 0,
- "one-var": [
- 1,
- "always"
- ],
- "no-shadow": 0,
- "no-param-reassign": 0,
- "prefer-const": 0,
- "no-prototype-builtins": 0,
- "no-script-url": 0,
- "global-require": 0,
- "max-len": [2, {"code" : 120}],
- "import/no-extraneous-dependencies": 0
}
};
diff --git a/site/src/scripts/components/Breadcrumb.js b/site/src/scripts/components/Breadcrumb.js
index 729afce5a..7fe940398 100644
--- a/site/src/scripts/components/Breadcrumb.js
+++ b/site/src/scripts/components/Breadcrumb.js
@@ -11,7 +11,7 @@ const WrapBreadcrumb = ({ routes }) => {
{ routes.map((route, index) => {
if(index < length - 1) {
return (
-
+
{route.path === 'app' ? 'home' : route.path}
);
diff --git a/site/src/scripts/components/impression/components/AttentionLink.js b/site/src/scripts/components/impression/components/AttentionLink.js
index ff2797ce7..50b43a702 100644
--- a/site/src/scripts/components/impression/components/AttentionLink.js
+++ b/site/src/scripts/components/impression/components/AttentionLink.js
@@ -17,8 +17,7 @@ const AttentionLink = ({ href, className, children, ...others }) => {
+ className={classnames('attention-link', className)}>
{children}
);
diff --git a/site/src/scripts/components/impression/components/NavLink.js b/site/src/scripts/components/impression/components/NavLink.js
index d8a28d0fb..7a08e9e00 100644
--- a/site/src/scripts/components/impression/components/NavLink.js
+++ b/site/src/scripts/components/impression/components/NavLink.js
@@ -4,18 +4,21 @@ import React, { PropTypes } from 'react';
// props校验
const propTypes = {
className: PropTypes.string,
- children: PropTypes.element.isRequired,
+ children: PropTypes.any,
};
/**
* NavLink 组件
*/
const NavLink = ({ children, className, ...others }) => {
+ if(!children) {
+ return children;
+ }
+
let childrenProps = {
className: classnames('nav-link', children.props.className),
};
- children.type.displayName === 'Link' && (childrenProps.activeClassName = 'active');
children = React.cloneElement(children, childrenProps);
return (
diff --git a/site/webpack.prod.config.js b/site/webpack.prod.config.js
index 91809d485..0d7dc3259 100755
--- a/site/webpack.prod.config.js
+++ b/site/webpack.prod.config.js
@@ -17,12 +17,18 @@ module.exports = {
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
- compress: true,
+ mangle: true,
+ compress: {
+ warnings: false,
+ },
comments: false,
mangle: {
except: ['$super', '$', 'exports', 'require', 'module']
}
- })
+ }),
+ new webpack.optimize.MinChunkSizePlugin({minChunkSize: 51200}),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.OccurrenceOrderPlugin(),
],
resolve: {
extensions: ['', '.js']
diff --git a/src/scripts/components/AttentionLink.js b/src/scripts/components/AttentionLink.js
index ff2797ce7..50b43a702 100644
--- a/src/scripts/components/AttentionLink.js
+++ b/src/scripts/components/AttentionLink.js
@@ -17,8 +17,7 @@ const AttentionLink = ({ href, className, children, ...others }) => {
+ className={classnames('attention-link', className)}>
{children}
);
diff --git a/src/scripts/components/NavLink.js b/src/scripts/components/NavLink.js
index d8a28d0fb..7a08e9e00 100644
--- a/src/scripts/components/NavLink.js
+++ b/src/scripts/components/NavLink.js
@@ -4,18 +4,21 @@ import React, { PropTypes } from 'react';
// props校验
const propTypes = {
className: PropTypes.string,
- children: PropTypes.element.isRequired,
+ children: PropTypes.any,
};
/**
* NavLink 组件
*/
const NavLink = ({ children, className, ...others }) => {
+ if(!children) {
+ return children;
+ }
+
let childrenProps = {
className: classnames('nav-link', children.props.className),
};
- children.type.displayName === 'Link' && (childrenProps.activeClassName = 'active');
children = React.cloneElement(children, childrenProps);
return (