Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
RELEASE: 0.4.4, 修复Nav.Link子节点为false时报错
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlq committed Sep 9, 2016
1 parent 2066b56 commit 3c91924
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 97 deletions.
44 changes: 2 additions & 42 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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}]
}
};
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
45 changes: 2 additions & 43 deletions site/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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
}
};
2 changes: 1 addition & 1 deletion site/src/scripts/components/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const WrapBreadcrumb = ({ routes }) => {
{ routes.map((route, index) => {
if(index < length - 1) {
return (
<Link key={route.path} to={`/${route.path}`}>
<Link key={index} to={`/${route.path}`}>
{route.path === 'app' ? 'home' : route.path}
</Link>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const AttentionLink = ({ href, className, children, ...others }) => {
<a
{...others}
href={href}
className={classnames('attention-link', className)}
>
className={classnames('attention-link', className)}>
{children}
</a>
);
Expand Down
7 changes: 5 additions & 2 deletions site/src/scripts/components/impression/components/NavLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
10 changes: 8 additions & 2 deletions site/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/components/AttentionLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const AttentionLink = ({ href, className, children, ...others }) => {
<a
{...others}
href={href}
className={classnames('attention-link', className)}
>
className={classnames('attention-link', className)}>
{children}
</a>
);
Expand Down
7 changes: 5 additions & 2 deletions src/scripts/components/NavLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 3c91924

Please sign in to comment.