-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configs search suggestions and so on
- Loading branch information
1 parent
4de30ab
commit e2bae85
Showing
26 changed files
with
385 additions
and
190 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
flickerApiKey : '19047cf8f892417333e03b550bd901a6', | ||
searchNetworkCallDelay : 500, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const searchBarActionTypes = { | ||
ON_CHANGE : 'searchBarActions/ON_CHANGE', | ||
ON_BLUR : 'searchBarActions/ON_BLUR', | ||
TRIGGER_SEARCH : 'searchBarActions/TRIGGER_SEARCH', | ||
HIDE_SUGGESTIONS: 'searchBarActions/HIDE_SUGGESTIONS', | ||
SHOW_SUGGESTIONS: 'searchBarActions/SHOW_SUGGESTIONS', | ||
SELECT_SUGGESTION: 'searchBarActions/SELECT_SUGGESTION', | ||
SET_SUGGESTIONS: 'searchBarActions/SET_SUGGESTIONS', | ||
SET_SEARCH_PARAM: 'searchBarActions/SET_SEARCH_PARAM', | ||
}; | ||
|
||
export default searchBarActionTypes; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import services from '../../services/flicker' | ||
import debounce from '../../scripts/debounce'; | ||
const searchBarActions = { | ||
showSuggestions: (payload) => () => { | ||
console.log('searching for suggestions with param: ', payload); | ||
|
||
services.searchForGroups(payload) | ||
.then(response =>{ | ||
console.log('Response received is: ', response); | ||
}); | ||
} | ||
}; | ||
|
||
export default searchBarActions; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import rightArrow from './right-arrow.png'; | ||
import searchIcon from './search.png'; | ||
|
||
export { | ||
rightArrow, | ||
searchIcon | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React,{ Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
|
||
import searchBarActions from '../../actions/searchBar/searchBarActions'; | ||
import { searchIcon } from '../../assets/images/common/'; | ||
import configs from '../../../configs'; | ||
|
||
import '../../styles/components/searchBar.scss'; | ||
|
||
|
||
class SearchBar extends Component{ | ||
|
||
static propTypes = { | ||
showSuggestions: PropTypes.func.isRequired, | ||
}; | ||
|
||
constructor(props){ | ||
super(props); | ||
this.state = { | ||
callNetworkFlag : true, | ||
} | ||
} | ||
|
||
onChangeHandler = (e) =>{ | ||
if(this.state.callNetworkFlag){ | ||
this.props.showSuggestions(e.target.value); | ||
this.setState({ | ||
callNetworkFlag: false | ||
}); | ||
} | ||
setTimeout(() =>{ | ||
this.setState({ | ||
callNetworkFlag: true | ||
}); | ||
}, configs.searchNetworkCallDelay); | ||
}; | ||
|
||
onEnterHandler = () =>{ | ||
|
||
}; | ||
|
||
render(){ | ||
return( | ||
<div className={'FF_searchbar-wrapper'}> | ||
<div className={'FF_searchbar-suggestions-wrapper'}> | ||
<div className={'FF_searchbar-suggestions-container'}> | ||
<div></div> | ||
</div> | ||
</div> | ||
|
||
<div className={'FF_searchbar-container'}> | ||
<div className={'FF_searchbar-icon-container'}> | ||
<img className={'FF_searchbar-icon'} src={searchIcon} /> | ||
</div> | ||
|
||
<input className={'FF_searchbar-input'} type={'text'} onChange={this.onChangeHandler} placeholder={'Search Group !'}/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = state =>({ | ||
searchBar : state.searchBar, | ||
}); | ||
|
||
const mapDispatchToProps = dispatch =>({ | ||
showSuggestions : searchParam => dispatch(searchBarActions.showSuggestions(searchParam)), | ||
}); | ||
export default connect(mapStateToProps, mapDispatchToProps)(SearchBar); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React,{ Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import '../../styles/components/topBar.scss'; | ||
|
||
class TopBar extends Component{ | ||
|
||
static propTypes = { | ||
|
||
}; | ||
|
||
render(){ | ||
return( | ||
<div className={'FF_topBar-wrapper'}> | ||
<div className={'FF_topBar-container'}> | ||
{this.props.children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default TopBar; |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { combineReducers } from 'redux'; | ||
|
||
import landingPageReducer from './landingPage/landingPageReducer'; | ||
import searchBarReducer from './searchBar/searchBarReducer'; | ||
|
||
const allReducers = combineReducers({ | ||
landingPage : landingPageReducer, | ||
searchBar : searchBarReducer, | ||
}); | ||
|
||
export default allReducers; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import searchBarActionTypes from "../../actions/searchBar/searchBarActionTypes"; | ||
|
||
const intialState = { | ||
searchParam : '', | ||
showSuggestions: 'false', | ||
suggestionsList : [] | ||
} | ||
|
||
const searchBarReducer = (state = intialState, action) => { | ||
switch(action.type){ | ||
case searchBarActionTypes.SET_SUGGESTIONS : return {...state, suggestionsList: action.payload}; | ||
case searchBarActionTypes.SET_SEARCH_PARAM : return {...state, searchParam: action.payload}; | ||
default: return state; | ||
}; | ||
} | ||
|
||
export default searchBarReducer; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React,{ Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
|
||
import GroupsPage from '../../components/groupsPage/groupsPage.jsx'; | ||
class GroupsPageContainer extends Component{ | ||
|
||
componentDidMount(){ | ||
|
||
} | ||
|
||
render(){ | ||
return( | ||
<div className={'BCN-landingPage'}> | ||
<GroupsPage/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = state =>({ | ||
|
||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(GroupsPageContainer); |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function debounce(func, wait, immediate) { | ||
// 'private' variable for instance | ||
// The returned function will be able to reference this due to closure. | ||
// Each call to the returned function will share this common timer. | ||
var timeout; | ||
|
||
// Calling debounce returns a new anonymous function | ||
return function() { | ||
// reference the context and args for the setTimeout function | ||
var context = this, | ||
args = arguments; | ||
|
||
// Should the function be called now? If immediate is true | ||
// and not already in a timeout then the answer is: Yes | ||
var callNow = immediate && !timeout; | ||
|
||
// This is the basic debounce behaviour where you can call this | ||
// function several times, but it will only execute once | ||
// [before or after imposing a delay]. | ||
// Each time the returned function is called, the timer starts over. | ||
clearTimeout(timeout); | ||
|
||
// Set the new timeout | ||
timeout = setTimeout(function() { | ||
|
||
// Inside the timeout function, clear the timeout variable | ||
// which will let the next execution run when in 'immediate' mode | ||
timeout = null; | ||
|
||
// Check if the function already ran with the immediate flag | ||
if (!immediate) { | ||
// Call the original function with apply | ||
// apply lets you define the 'this' object as well as the arguments | ||
// (both captured before setTimeout) | ||
func.apply(context, args); | ||
} | ||
}, wait); | ||
|
||
// Immediate mode and no wait timer? Execute the function.. | ||
if (callNow) func.apply(context, args); | ||
} | ||
} | ||
|
||
export default debounce; |
Oops, something went wrong.