Skip to content
This repository was archived by the owner on May 23, 2018. It is now read-only.

Commit 7fd80e3

Browse files
committed
fix: syntax and bugs
1 parent 51700e0 commit 7fd80e3

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

dist/amd/link-factory.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ define(['exports', 'module', 'react'], function (exports, module, _react) {
1313
routeName: _React['default'].PropTypes.string.isRequired,
1414
routeParams: _React['default'].PropTypes.object,
1515
routeOptions: _React['default'].PropTypes.object,
16-
activeClass: _React['default'].PropTypes.string,
16+
activeClassName: _React['default'].PropTypes.string,
1717
onClick: _React['default'].PropTypes.func
1818
},
1919

2020
getDefaultProps: function getDefaultProps() {
2121
return {
2222
className: '',
23-
activeClass: 'active',
23+
activeClassName: 'active',
2424
routeParams: {},
2525
routeOptions: {},
2626
onClick: this.clickHandler
@@ -32,7 +32,7 @@ define(['exports', 'module', 'react'], function (exports, module, _react) {
3232
// Not an anti-pattern
3333
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
3434
return {
35-
active: router.isActive(this.props.routeName, this.prop.routeParams)
35+
active: router.isActive(this.props.routeName, this.props.routeParams)
3636
};
3737
},
3838

@@ -50,7 +50,7 @@ define(['exports', 'module', 'react'], function (exports, module, _react) {
5050
// Should it be an option to observe state in Links?
5151
// Should we add a GroupLink component for menus?
5252
routeChangeHandler: function routeChangeHandler(toState, fromState) {
53-
this.setState({ active: router.isActive(this.props.routeName, this.prop.routeParams) });
53+
this.setState({ active: router.isActive(this.props.routeName, this.props.routeParams) });
5454
},
5555

5656
componentDidMount: function componentDidMount() {
@@ -65,10 +65,10 @@ define(['exports', 'module', 'react'], function (exports, module, _react) {
6565
var props = this.props;
6666
var active = this.state.active;
6767

68-
var href = router.buildPath(this.props.routeName, this.props.routeParams);
69-
var className = props.className.split(' ').concat(active ? [activeClassName] : []).join(' ');
68+
var href = router.buildUrl(props.routeName, props.routeParams);
69+
var className = props.className.split(' ').concat(active ? [props.activeClassName] : []).join(' ');
7070

71-
return _React['default'].CreateElement('a', { href: href, className: className, onClick: onClick });
71+
return _React['default'].createElement('a', { href: href, className: props.className, onClick: props.onClick });
7272
}
7373
});
7474
}

dist/browser/router5-react.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ function linkFactory(router) {
3131
routeName: React.PropTypes.string.isRequired,
3232
routeParams: React.PropTypes.object,
3333
routeOptions: React.PropTypes.object,
34-
activeClass: React.PropTypes.string,
34+
activeClassName: React.PropTypes.string,
3535
onClick: React.PropTypes.func
3636
},
3737

3838
getDefaultProps: function getDefaultProps() {
3939
return {
4040
className: '',
41-
activeClass: 'active',
41+
activeClassName: 'active',
4242
routeParams: {},
4343
routeOptions: {},
4444
onClick: this.clickHandler
@@ -50,7 +50,7 @@ function linkFactory(router) {
5050
// Not an anti-pattern
5151
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
5252
return {
53-
active: router.isActive(this.props.routeName, this.prop.routeParams)
53+
active: router.isActive(this.props.routeName, this.props.routeParams)
5454
};
5555
},
5656

@@ -68,7 +68,7 @@ function linkFactory(router) {
6868
// Should it be an option to observe state in Links?
6969
// Should we add a GroupLink component for menus?
7070
routeChangeHandler: function routeChangeHandler(toState, fromState) {
71-
this.setState({ active: router.isActive(this.props.routeName, this.prop.routeParams) });
71+
this.setState({ active: router.isActive(this.props.routeName, this.props.routeParams) });
7272
},
7373

7474
componentDidMount: function componentDidMount() {
@@ -83,10 +83,10 @@ function linkFactory(router) {
8383
var props = this.props;
8484
var active = this.state.active;
8585

86-
var href = router.buildPath(this.props.routeName, this.props.routeParams);
87-
var className = props.className.split(' ').concat(active ? [activeClassName] : []).join(' ');
86+
var href = router.buildUrl(props.routeName, props.routeParams);
87+
var className = props.className.split(' ').concat(active ? [props.activeClassName] : []).join(' ');
8888

89-
return React.CreateElement('a', { href: href, className: className, onClick: onClick });
89+
return React.createElement('a', { href: href, className: props.className, onClick: props.onClick });
9090
}
9191
});
9292
}

dist/browser/router5-react.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/commonjs/link-factory.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function linkFactory(router) {
1818
routeName: _react2['default'].PropTypes.string.isRequired,
1919
routeParams: _react2['default'].PropTypes.object,
2020
routeOptions: _react2['default'].PropTypes.object,
21-
activeClass: _react2['default'].PropTypes.string,
21+
activeClassName: _react2['default'].PropTypes.string,
2222
onClick: _react2['default'].PropTypes.func
2323
},
2424

2525
getDefaultProps: function getDefaultProps() {
2626
return {
2727
className: '',
28-
activeClass: 'active',
28+
activeClassName: 'active',
2929
routeParams: {},
3030
routeOptions: {},
3131
onClick: this.clickHandler
@@ -37,7 +37,7 @@ function linkFactory(router) {
3737
// Not an anti-pattern
3838
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
3939
return {
40-
active: router.isActive(this.props.routeName, this.prop.routeParams)
40+
active: router.isActive(this.props.routeName, this.props.routeParams)
4141
};
4242
},
4343

@@ -55,7 +55,7 @@ function linkFactory(router) {
5555
// Should it be an option to observe state in Links?
5656
// Should we add a GroupLink component for menus?
5757
routeChangeHandler: function routeChangeHandler(toState, fromState) {
58-
this.setState({ active: router.isActive(this.props.routeName, this.prop.routeParams) });
58+
this.setState({ active: router.isActive(this.props.routeName, this.props.routeParams) });
5959
},
6060

6161
componentDidMount: function componentDidMount() {
@@ -70,10 +70,10 @@ function linkFactory(router) {
7070
var props = this.props;
7171
var active = this.state.active;
7272

73-
var href = router.buildPath(this.props.routeName, this.props.routeParams);
74-
var className = props.className.split(' ').concat(active ? [activeClassName] : []).join(' ');
73+
var href = router.buildUrl(props.routeName, props.routeParams);
74+
var className = props.className.split(' ').concat(active ? [props.activeClassName] : []).join(' ');
7575

76-
return _react2['default'].CreateElement('a', { href: href, className: className, onClick: onClick });
76+
return _react2['default'].createElement('a', { href: href, className: props.className, onClick: props.onClick });
7777
}
7878
});
7979
}

modules/link-factory.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ export default linkFactory
55
function linkFactory(router) {
66
return React.createClass({
77
propTypes: {
8-
routeName: React.PropTypes.string.isRequired,
9-
routeParams: React.PropTypes.object,
10-
routeOptions: React.PropTypes.object,
11-
activeClass: React.PropTypes.string,
12-
onClick: React.PropTypes.func
8+
routeName: React.PropTypes.string.isRequired,
9+
routeParams: React.PropTypes.object,
10+
routeOptions: React.PropTypes.object,
11+
activeClassName: React.PropTypes.string,
12+
onClick: React.PropTypes.func
1313
},
1414

1515
getDefaultProps() {
1616
return {
17-
className: '',
18-
activeClass: 'active',
19-
routeParams: {},
20-
routeOptions: {},
21-
onClick: this.clickHandler
17+
className: '',
18+
activeClassName: 'active',
19+
routeParams: {},
20+
routeOptions: {},
21+
onClick: this.clickHandler
2222
};
2323
},
2424

@@ -27,7 +27,7 @@ function linkFactory(router) {
2727
// Not an anti-pattern
2828
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
2929
return {
30-
active: router.isActive(this.props.routeName, this.prop.routeParams)
30+
active: router.isActive(this.props.routeName, this.props.routeParams)
3131
};
3232
},
3333

@@ -48,7 +48,7 @@ function linkFactory(router) {
4848
// Should it be an option to observe state in Links?
4949
// Should we add a GroupLink component for menus?
5050
routeChangeHandler(toState, fromState) {
51-
this.setState({active: router.isActive(this.props.routeName, this.prop.routeParams)})
51+
this.setState({active: router.isActive(this.props.routeName, this.props.routeParams)})
5252
},
5353

5454
componentDidMount() {
@@ -63,11 +63,11 @@ function linkFactory(router) {
6363
let props = this.props
6464
let active = this.state.active
6565

66-
let href = router.buildPath(this.props.routeName, this.props.routeParams);
66+
let href = router.buildUrl(props.routeName, props.routeParams);
6767
let className = props.className.split(' ')
68-
.concat(active ? [activeClassName] : []).join(' ')
68+
.concat(active ? [props.activeClassName] : []).join(' ')
6969

70-
return React.CreateElement('a', {href, className, onClick})
70+
return React.createElement('a', {href, className: props.className, onClick: props.onClick})
7171
}
7272
})
7373
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "router5-react",
3-
"version": "0.1.0-alpha.3",
3+
"version": "0.1.0-alpha.4",
44
"description": "router5 helpers for React",
55
"main": "dist/commonjs/index.js",
66
"scripts": {
@@ -27,12 +27,12 @@
2727
},
2828
"homepage": "http://router5.github.com/router5/router5-react",
2929
"devDependencies": {
30-
"router5": "0.1.0-rc.4",
30+
"router5": "latest",
3131
"async": "^1.3.0",
3232
"babel": "^5.6.14",
3333
"uglify-js2": "^2.1.11"
3434
},
3535
"peerDependencies": {
36-
"router5": "0.1.0-rc.4"
36+
"router5": ">=0.1.0-rc.5"
3737
}
3838
}

0 commit comments

Comments
 (0)