This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.js': | |
'onclick': | |
'prefix': 'click' | |
'body': '$("$1").on("click", function(){ \n\t$2 \n});' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('$1$').on('click', function(){ | |
$2$ | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends Component { | |
constructor(props){ | |
super(props); | |
this.state = { | |
restaurants: initialRestaurants, | |
sorting: initialSorting, | |
} | |
this.toggleFavourite = this.toggleFavourite.bind(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
return( | |
<Provider store={store}> | |
<Container> | |
<SearchBar /> | |
<RestaurantList /> | |
</Container> | |
</Provider> | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Input as SemanticInput } from 'semantic-ui-react'; | |
import { connect } from 'react-redux'; | |
import { search } from '../../actions/index'; | |
class Input extends Component { | |
render() { | |
return( | |
<SemanticInput | |
onChange={(e) => {this.props.search(e.target.value);}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const SEARCH = 'SEARCH'; | |
export const search = (term) => ({ | |
type: SEARCH, | |
payload: {term} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as actions from '../actions/index'; | |
import Utility from '../controller/Utility/Utility'; | |
export const restaurantsReducer = (state = {}, action) => { | |
switch (action.type) { | |
case actions.SEARCH: | |
return Utility.search(action.payload.term, state); | |
default: | |
return state; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from 'redux'; | |
import { restaurantsReducer } from './restaurantsReducer'; | |
export const rootReducer = combineReducers({ | |
restaurantsReducer | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore } from 'redux'; | |
import { rootReducer } from './reducers/rootReducer'; | |
export const store = createStore(rootReducer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Container } from 'semantic-ui-react' | |
import RestaurantList from '../../container/RestaurantList/RestaurantList'; | |
import SearchBar from '../SearchBar/SearchBar'; | |
import { Provider } from 'react-redux'; | |
import { store } from '../../store'; | |
const App = () => { | |
return( | |
<Provider store={store}> |
OlderNewer