Skip to content

Commit c62c5ae

Browse files
committed
rename App to SearchBox, rename props
1 parent e3ed4d3 commit c62c5ae

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

web/src/App.js renamed to web/src/SearchBox.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ import SearchResults from './SearchResults';
1414

1515
export default observer(class App extends Component {
1616
static propTypes = {
17-
colors: React.PropTypes.object.isRequired
17+
searchStore: React.PropTypes.object.isRequired
1818
};
1919

2020
render() {
2121
return (
2222
<MuiThemeProvider>
2323
<div>
24-
<SearchInput query={this.props.colors.query}
25-
onQueryUpdate={value => this.props.colors.updateQuery(value)}
26-
onSubmit={() => this.props.colors.search()}
24+
<SearchInput query={this.props.searchStore.query}
25+
onQueryUpdate={value => this.props.searchStore.updateQuery(value)}
26+
onSubmit={() => this.props.searchStore.search()}
2727
/>
28-
<SearchResults colors={this.props.colors.results.slice()}/>
28+
<SearchResults results={this.props.searchStore.results.slice()}/>
2929
</div>
3030
</MuiThemeProvider>
3131
);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import App from './App';
2+
import App from './SearchBox';
33
import getMuiTheme from 'material-ui/styles/getMuiTheme';
44
import {TextField, ListItem} from 'material-ui'
55

@@ -11,7 +11,7 @@ const muiTheme = getMuiTheme();
1111
const mountWithContext = (node) => mount(node, {context: {muiTheme}});
1212

1313
it('shows search results', () => {
14-
const wrapper = mountWithContext(<App colors={new Colors()} />);
14+
const wrapper = mountWithContext(<App searchStore={new Colors()} />);
1515
const textField = wrapper.find(TextField);
1616
textField.props().onChange(null, 'Blue G');
1717
textField.props().onKeyDown({

web/src/SearchResults.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import {List, ListItem, Divider} from 'material-ui'
33

4-
const SearchResults = ({colors}) => {
5-
const listItems = colors.map((color, index) => {
4+
const SearchResults = ({results}) => {
5+
const listItems = results.map((result, index) => {
66
return (
7-
<div key={`color-div-${index}`}>
8-
<ListItem key={`color-${index}`} primaryText={color.name} style={{backgroundColor: color.hex} }/>
7+
<div key={`result-div-${index}`}>
8+
<ListItem key={`result-${index}`} primaryText={result.name} style={{backgroundColor: result.hex} }/>
99
<Divider key={`divider-${index}`}/>
1010
</div>
1111
);
@@ -18,7 +18,7 @@ const SearchResults = ({colors}) => {
1818
};
1919

2020
SearchResults.propTypes = {
21-
colors: React.PropTypes.array.isRequired
21+
results: React.PropTypes.array.isRequired
2222
};
2323

2424
export default SearchResults;

web/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import App from './App';
3+
import App from './SearchBox';
44
import './index.css';
55

66
import Colors from './colors'
77

88
ReactDOM.render(
9-
<App colors={new Colors()}/>,
9+
<App searchStore={new Colors()}/>,
1010
document.getElementById('root')
1111
);

0 commit comments

Comments
 (0)