Skip to content

Commit c4e817b

Browse files
committed
#25 Upgrade to latest version of React Bootstrap
1 parent 2985511 commit c4e817b

File tree

7 files changed

+50
-69
lines changed

7 files changed

+50
-69
lines changed

samples/AspnetReact.Webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"axios": "^0.13.1",
2121
"lodash": "^4.13.1",
2222
"react": "^15.2.1",
23-
"react-bootstrap": "^0.29.4",
23+
"react-bootstrap": "^0.30.2",
2424
"react-dom": "^15.2.1",
2525
"react-overlays": "^0.6.5"
2626
},

samples/AspnetReact.Webpack/reactApp/components/app.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, {Component} from 'react';
22

33
import '../styles/site.scss';
44

5-
import Counter from './counter.jsx';
65
import MainController from './mainController.jsx';
76
import githubLogo from '../images/github-logo.png';
87
import largeImage from '../images/react-large.png';

samples/AspnetReact.Webpack/reactApp/components/counter.jsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

samples/AspnetReact.Webpack/reactApp/components/mainController.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MainController extends Component {
1515

1616
handleSearch(search, language) {
1717
ApiService.searchRepositories(search, language).then(data => {
18-
this.setState({repositories: data.items});
18+
this.setState({repositories: data.items, activeRepository: {}});
1919
});
2020
}
2121

samples/AspnetReact.Webpack/reactApp/components/searchForm.jsx

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
import React, {Component, PropTypes} from 'react';
2-
import {Input, Button} from 'react-bootstrap';
2+
import {FormGroup, ControlLabel, FormControl, Button} from 'react-bootstrap';
33
import {AutoAffix} from 'react-overlays';
44

55
class SearchForm extends Component {
66
constructor(props) {
77
super(props);
88

9-
this.handleClick = this.handleClick.bind(this);
9+
this.state = {
10+
repository: '',
11+
language: '',
12+
};
13+
this.handleRepositoryChange = this.handleRepositoryChange.bind(this);
14+
this.handleLanguageChange = this.handleLanguageChange.bind(this);
15+
this.handleSubmitClick = this.handleSubmitClick.bind(this);
1016
}
1117

12-
handleClick() {
13-
const repositoryValue = this.refs.repository.getValue();
14-
const languageValue = this.refs.language.getValue();
15-
if (repositoryValue) {
16-
if (languageValue !== 'undefined') {
17-
this.props.search(repositoryValue, languageValue);
18+
handleRepositoryChange(e) {
19+
this.setState({repository: e.target.value});
20+
}
21+
22+
handleLanguageChange(e) {
23+
this.setState({language: e.target.value});
24+
}
25+
26+
handleSubmitClick() {
27+
const {repository, language} = this.state;
28+
if (repository) {
29+
if (language) {
30+
this.props.search(repository, language);
1831
} else {
19-
this.props.search(repositoryValue);
32+
this.props.search(repository);
2033
}
2134
}
2235
}
@@ -25,21 +38,30 @@ class SearchForm extends Component {
2538
return (
2639
<AutoAffix viewportOffsetTop={55}>
2740
<div>
28-
<Input
29-
type="text"
30-
ref="repository"
31-
label="Enter a keyword to search Github"
32-
placeholder="search term"
33-
/>
34-
<Input type="select" ref="language" label="Optianally select a language">
35-
<option value="undefined">Select a language</option>
36-
<option value="javascript">JavaScript</option>
37-
<option value="csharp">C#</option>
38-
<option value="python">Python</option>
39-
<option value="ruby">Ruby</option>
40-
<option value="java">Java</option>
41-
</Input>
42-
<Button bsStyle="primary" onClick={this.handleClick}>Search</Button>
41+
<FormGroup controlId="repositorySearch">
42+
<ControlLabel>Enter a keyword to search Github</ControlLabel>
43+
<FormControl
44+
type="text"
45+
value={this.state.repository}
46+
onChange={this.handleRepositoryChange}
47+
placeholder="search term"
48+
/>
49+
</FormGroup>
50+
<FormGroup controlId="formControlsSelect">
51+
<ControlLabel>Optianally select a programming language</ControlLabel>
52+
<FormControl
53+
componentClass="select"
54+
onChange={this.handleLanguageChange}
55+
placeholder="Select a programming language">
56+
<option value="undefined">Select a language</option>
57+
<option value="javascript">JavaScript</option>
58+
<option value="csharp">C#</option>
59+
<option value="python">Python</option>
60+
<option value="ruby">Ruby</option>
61+
<option value="java">Java</option>
62+
</FormControl>
63+
</FormGroup>
64+
<Button bsStyle="primary" onClick={this.handleSubmitClick}>Search</Button>
4365
</div>
4466
</AutoAffix>
4567
);

samples/AspnetReact.Webpack/reactApp/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import ReactDOM from 'react-dom';
33

44
import App from './components/app.jsx';
55

6-
const reactAppNode = document.getElementById('react-app');
7-
ReactDOM.render(<App />, reactAppNode);
6+
ReactDOM.render(<App />, document.getElementById('react-app'));

samples/AspnetReact.Webpack/reactApp/styles/site.scss

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@ $secondsColor: red;
22

33
body {
44
padding-top: 60px;
5-
padding-bottom: 20px;
6-
}
7-
8-
.body-content {
9-
padding-left: 15px;
10-
padding-right: 15px;
11-
}
12-
13-
#seconds {
14-
background-color: $secondsColor;
5+
padding-bottom: 40px;
156
}
167

178
#github-logo{

0 commit comments

Comments
 (0)