File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed
Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,18 @@ import SearchResults from './SearchResults';
1414
1515export 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 ) ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import App from './App ' ;
2+ import App from './SearchBox ' ;
33import getMuiTheme from 'material-ui/styles/getMuiTheme' ;
44import { TextField , ListItem } from 'material-ui'
55
@@ -11,7 +11,7 @@ const muiTheme = getMuiTheme();
1111const mountWithContext = ( node ) => mount ( node , { context : { muiTheme} } ) ;
1212
1313it ( '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 ( {
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { 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
2020SearchResults . propTypes = {
21- colors : React . PropTypes . array . isRequired
21+ results : React . PropTypes . array . isRequired
2222} ;
2323
2424export default SearchResults ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
3- import App from './App ' ;
3+ import App from './SearchBox ' ;
44import './index.css' ;
55
66import Colors from './colors'
77
88ReactDOM . render (
9- < App colors = { new Colors ( ) } /> ,
9+ < App searchStore = { new Colors ( ) } /> ,
1010 document . getElementById ( 'root' )
1111) ;
You can’t perform that action at this time.
0 commit comments