Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ac500c8

Browse files
committed
[changed] Replace everything with LinkContainer
1 parent 888fc56 commit ac500c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+639
-1805
lines changed

.eslintignore

-4
This file was deleted.

.eslintrc

+2-36
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,7 @@
11
{
2-
"extends": ["eslint-config-airbnb"],
3-
"env": {
4-
"browser": true,
5-
"node": true
6-
},
7-
"ecmaFeatures": {
8-
"jsx": true
9-
},
10-
"parser": "babel-eslint",
11-
"plugins": [
12-
"react",
13-
"babel"
14-
],
2+
"extends": "airbnb",
153
"rules": {
164
"comma-dangle": 0,
17-
"comma-spacing": 1,
18-
"key-spacing": 0,
19-
"no-eq-null": 0,
20-
"no-param-reassign": 0,
21-
"no-underscore-dangle": 0,
22-
"no-undef": 2,
23-
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
24-
"no-var": 2,
25-
"babel/object-shorthand": 2,
26-
"quotes": [1, "single", "avoid-escape"],
27-
"react/display-name": 0,
28-
"react/jsx-no-undef": 2,
29-
"react/jsx-quotes": 0,
30-
"react/jsx-uses-react": 2,
31-
"react/no-did-mount-set-state": 2,
32-
"react/no-did-update-set-state": 2,
33-
"react/no-multi-comp": 2,
34-
"react/prop-types": [1, { "ignore": ["children", "className"] }],
35-
"react/react-in-jsx-scope": 2,
36-
"react/self-closing-comp": 1,
37-
"react/wrap-multilines": 2,
38-
"react/jsx-uses-vars": 1,
39-
"strict": 0
5+
"no-eq-null": 0
406
}
417
}

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing
22

3-
As part of the react-bootstrap organization all contributing guidelines can be
4-
found at:
5-
https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md
3+
As part of the react-bootstrap organization all contributing guidelines can be found at: https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md.
64

7-
Note that automated changelog generation has not been setup on this repo yet.
5+
Use `npm run visual-test` to check the appearance of components in your browser. The page will load at [http://localhost:8080/](http://localhost:8080/).
6+
7+
Note that automated changelog generation has not been set up on this repo yet.

README.md

+13-107
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,33 @@
11
# react-router-bootstrap
2+
Integration between [React Router](https://github.com/rackt/react-router) and [React-Bootstrap](https://github.com/react-bootstrap/react-bootstrap).
23

34
[![Build Status](https://travis-ci.org/react-bootstrap/react-router-bootstrap.svg?branch=master)](https://travis-ci.org/react-bootstrap/react-router-bootstrap)
5+
[![npm version](https://badge.fury.io/js/react-router-bootstrap.svg)](http://badge.fury.io/js/react-router-bootstrap)
46

5-
Intregation between [react-router](https://github.com/rackt/react-router) and [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap)
6-
7-
This package gives you react-router compatible substitutes for:
8-
9-
- `NavItem` -> `NavItemLink`
10-
- `Button` -> `ButtonLink`
11-
- `MenuItem` -> `MenuItemLink`
12-
- `ListGroupItem` -> `ListGroupItemLink`
13-
- `PageItem` -> `PageItemLink`
14-
- `Thumbnail` -> `ThumbnailLink`
15-
16-
Turning this:
7+
## Usage
178

18-
```jsx
19-
React.createClass({
20-
mixins: [State, Navigation],
9+
Wrap your React-Bootstrap element in a `LinkContainer` to make it behave like a React Router `Link`:
2110

22-
render: function() {
23-
var href = this.makeHref('destination', {some: 'params'}, {some: 'query param'});
24-
var isActive = this.isActive('destination', {some: 'params'}, {some: 'query param'});
25-
return <Button href={href} active={isActive}>;
26-
}
27-
});
11+
```js
12+
<LinkContainer to="/foo" query={{bar: "baz"}}>
13+
<Button>Foo</Button>
14+
</LinkContainer>
2815
```
2916

30-
Into this
31-
32-
```jsx
33-
React.createClass({
34-
render: function() {
35-
return <ButtonLink to="destination" params={{ some: 'params' }} query={{some: 'query param'}}>;
36-
}
37-
});
38-
```
17+
To disable the element and the link, set the `disabled` prop on the `LinkContainer`. For the equivalent of `IndexLink`, use `IndexLinkContainer`.
3918

4019
## Installation
4120

4221
```
43-
npm install --save react-router-bootstrap
22+
npm install react-router-bootstrap
4423
```
4524

46-
You will also (if you haven't already) want to install `react-router` and `react-bootstrap`
25+
You will also want to have React Router and React-Bootstrap.
4726

4827
```
49-
npm install --save react-router react-bootstrap
50-
```
51-
52-
## Usage
53-
54-
A simple example
55-
56-
```jsx
57-
var Router = require('react-router')
58-
, RouteHandler = Router.RouteHandler
59-
, Route = Router.Route;
60-
61-
var ReactBootstrap = require('react-bootstrap')
62-
, Nav = ReactBootstrap.Nav
63-
, ListGroup = ReactBootstrap.ListGroup;
64-
65-
var ReactRouterBootstrap = require('react-router-bootstrap')
66-
, NavItemLink = ReactRouterBootstrap.NavItemLink
67-
, ButtonLink = ReactRouterBootstrap.ButtonLink
68-
, ListGroupItemLink = ReactRouterBootstrap.ListGroupItemLink;
69-
70-
var App = React.createClass({
71-
render: function() {
72-
return (
73-
<div>
74-
NavItemLink<br />
75-
<Nav>
76-
<NavItemLink
77-
to="destination"
78-
params={{ someparam: 'hello' }}>
79-
Linky!
80-
</NavItemLink>
81-
</Nav>
82-
<br />
83-
ButtonLink<br />
84-
<ButtonLink
85-
to="destination"
86-
params={{ someparam: 'hello' }}>
87-
Linky!
88-
</ButtonLink>
89-
<br />
90-
<ListGroup>
91-
<ListGroupItemLink
92-
to="destination"
93-
params={{ someparam: 'hello' }}>
94-
Linky!
95-
</ListGroupItemLink>
96-
</ListGroup>
97-
<RouteHandler />
98-
</div>
99-
);
100-
}
101-
});
102-
103-
var Destination = React.createClass({
104-
render: function() {
105-
return <div>You made it!</div>;
106-
}
107-
});
108-
109-
var routes = (
110-
<Route handler={App} path="/">
111-
<Route name="destination" path="destination/:someparam" handler={Destination} />
112-
</Route>
113-
);
114-
115-
Router.run(routes, function (Handler) {
116-
React.render(<Handler/>, document.body);
117-
});
118-
28+
npm install react-router react-bootstrap
11929
```
12030

12131
## Contributing
12232

123-
See [CONTRIBUTING](CONTRIBUTING.md)
124-
125-
Use `npm run visual-test` command to check components appearance in browser. It will open browser with a blank page. Then after `webpack-server` finishes its bundling, the browser automatically will refresh the page.
126-
127-
URL for it: http://localhost:8080/public/visual#/
33+
See [CONTRIBUTING](CONTRIBUTING.md).

assets/thumbnail.png

-3.84 KB
Binary file not shown.

karma.conf.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@ delete webpackConfig.entry;
44

55
module.exports = function (config) {
66
config.set({
7-
87
basePath: '',
98

10-
frameworks: [ 'mocha' ],
9+
frameworks: [
10+
'mocha',
11+
'sinon-chai'
12+
],
1113

1214
files: [
1315
'./tests/index.js'
1416
],
1517

16-
exclude: [],
17-
1818
preprocessors: {
19-
'./tests/index.js': [ 'webpack' ]
19+
'./tests/index.js': ['webpack', 'sourcemap']
2020
},
2121

22-
webpack: [ webpackConfig ],
22+
webpack: webpackConfig,
2323

24-
webpackMiddleware: { },
24+
webpackMiddleware: {
25+
noInfo: true
26+
},
2527

26-
reporters: [ 'mocha' ],
28+
reporters: ['mocha'],
2729

2830
port: 9876,
2931

@@ -33,7 +35,7 @@ module.exports = function (config) {
3335

3436
autoWatch: true,
3537

36-
browsers: [ 'PhantomJS' ],
38+
browsers: ['PhantomJS'],
3739

3840
captureTimeout: 60000,
3941
browserDisconnectTimeout: 7000,

package.json

+41-39
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
{
22
"name": "react-router-bootstrap",
33
"version": "0.18.1",
4-
"description": "react-router and react-bootstrap compatible components",
4+
"description": "Integration between React Router and React-Bootstrap",
55
"main": "./lib/index.js",
66
"scripts": {
77
"prepublish": "npm run build",
8-
"build": "babel src --out-dir=lib && webpack && COMPRESS=1 webpack && npm run bower-prepare",
8+
"build": "babel src --out-dir=lib && webpack && webpack -p",
99
"test": "npm run lint && karma start --single-run",
1010
"tdd": "karma start",
11-
"visual-test": "open http://localhost:8080/public/visual#/ && webpack-dev-server --config webpack.test.config.babel.js",
12-
"lint": "eslint ./",
13-
"bower-prepare": "babel-node scripts/bower-prepare.js",
14-
"patch": "release patch",
15-
"minor": "release minor",
16-
"major": "release major"
11+
"visual-test": "open http://localhost:8080/ && webpack-dev-server --config webpack.visual.config.babel.js",
12+
"lint": "eslint *.babel.js src tests",
13+
"release": "release"
1714
},
1815
"repository": {
1916
"type": "git",
@@ -34,48 +31,53 @@
3431
},
3532
"homepage": "https://github.com/react-bootstrap/react-router-bootstrap",
3633
"peerDependencies": {
37-
"react-bootstrap": ">=0.22.4",
38-
"react-router": ">=0.13.1"
34+
"react": ">=0.13.0 || >=0.14.0-rc1",
35+
"react-router": ">=1.0.0-rc1"
3936
},
4037
"devDependencies": {
41-
"babel": "^5.5.6",
42-
"babel-core": "^5.5.6",
43-
"babel-eslint": "^4.0.5",
44-
"babel-loader": "^5.1.4",
45-
"bootstrap": "^3.3.1",
46-
"chai": "^3.0.0",
47-
"colors": "^1.1.2",
48-
"css-loader": "^0.15.3",
49-
"eslint": "^1.0.0",
50-
"eslint-config-airbnb": "0.0.7",
51-
"eslint-plugin-babel": "^1.0.0",
52-
"eslint-plugin-mocha": "^0.4.0",
53-
"eslint-plugin-react": "^3.1.0",
54-
"karma": "^0.13.3",
38+
"babel": "^5.8.23",
39+
"babel-core": "^5.8.24",
40+
"babel-eslint": "^4.1.2",
41+
"babel-loader": "^5.3.2",
42+
"bootstrap": "^3.3.5",
43+
"css-loader": "^0.18.0",
44+
"es5-shim": "^4.1.13",
45+
"eslint": "1.3.x",
46+
"eslint-config-airbnb": "0.0.8",
47+
"eslint-plugin-babel": "^2.1.1",
48+
"eslint-plugin-mocha": "^0.5.1",
49+
"eslint-plugin-react": "^3.3.2",
50+
"file-loader": "^0.8.4",
51+
"history": "^1.9.1",
52+
"html-webpack-plugin": "^1.6.1",
53+
"karma": "^0.13.9",
5554
"karma-cli": "^0.1.0",
5655
"karma-mocha": "^0.2.0",
57-
"karma-mocha-reporter": "^1.0.2",
58-
"karma-phantomjs-launcher": "^0.2.0",
59-
"karma-webpack": "^1.5.0",
56+
"karma-mocha-reporter": "^1.1.1",
57+
"karma-phantomjs-launcher": "^0.2.1",
58+
"karma-sinon-chai": "^1.1.0",
59+
"karma-sourcemap-loader": "^0.3.5",
60+
"karma-webpack": "^1.7.0",
6061
"less": "^2.5.1",
6162
"less-loader": "^2.2.0",
62-
"lodash": "^3.10.0",
63-
"mocha": "^2.1.0",
64-
"mt-changelog": "^0.6.1",
63+
"mocha": "^2.3.2",
64+
"mt-changelog": "^0.6.2",
6565
"node-libs-browser": "^0.5.2",
66-
"phantomjs": "^1.9.13",
67-
"react": ">0.10.0",
68-
"react-bootstrap": ">=0.22.4",
69-
"react-router": ">=0.13.1",
70-
"release-script": "^0.2.1",
71-
"shelljs": "^0.5.1",
66+
"phantomjs": "^1.9.18",
67+
"react": "^0.14.0-rc1",
68+
"react-bootstrap": "^0.25.100-react-pre.1",
69+
"react-dom": "^0.14.0-rc1",
70+
"react-router": "^1.0.0-rc1",
71+
"release-script": "^0.2.7",
7272
"style-loader": "^0.12.3",
7373
"url-loader": "^0.5.6",
74-
"webpack": "^1.4.15",
75-
"webpack-dev-server": "^1.7.0",
76-
"yargs": "^3.15.0"
74+
"webpack": "^1.12.1",
75+
"webpack-dev-server": "^1.10.1",
76+
"yargs": "^3.25.0"
7777
},
7878
"files": [
79+
"README",
80+
"CHANGELOG.md",
7981
"lib"
8082
],
8183
"release-script": {

0 commit comments

Comments
 (0)