Commit 7a8cff6b authored by Mattias J Duffy's avatar Mattias J Duffy
Browse files

commiting changes before rebase to master

parent bfa123da
import { TOGGLE_DRAWER,SET_SIDEBAR,SET_SEARCH_TERM,SET_FILTERED_LIST } from './action-types';
import { TOGGLE_DRAWER,SET_SIDEBAR,SET_SEARCH_TERM } from './action-types';
export const toggleDrawer = () => ({
type:TOGGLE_DRAWER,
......@@ -9,8 +9,10 @@ export const setSidebar = (facility) => ({
facility,
})
export const setSearchTerm = (term) => ({
type:SET_SEARCH_TERM,
term,
})
export const setSearchTerm = (term) => {
return {
type:SET_SEARCH_TERM,
term,
}
}
......@@ -3,7 +3,11 @@ import {withStyles} from 'material-ui/styles';
import FacilityCard from '../containers/FacilityCard'
import Grid from 'material-ui/Grid';
const CardContainer = ({classes, facilities}) => {
const CardContainer = ({classes, searchTerm,facilities}) => {
const filterCards = (facility) => {
return facility.name.includes(searchTerm)
}
console.log(searchTerm)
return (
<Grid container className={classes.root} spacing={24}>
{facilities.map(item =>
......
......@@ -71,7 +71,7 @@ class Layout extends React.Component {
Default
</Button> */}
<SearchBar suggestions={suggestions}/>
<CardContainer facilities={this.props.facilities}/>
<CardContainer searchTerm={this.props.searchTerm} facilities={this.props.facilities}/>
</div>
<Sidebar facility={sidebarFacility}/>
</div>
......@@ -102,6 +102,7 @@ const styleSheet = {
function mapStateToProps(state) {
return {
facilities: state.facilities.data,
searchTerm:state.ui.search.term,
isLoading: state.facilities.isLoading,
sidebarFacility:state.ui.sidebar,
}
......
......@@ -152,15 +152,15 @@ class IntegrationAutosuggest extends React.Component {
};
handleSuggestionsFetchRequested = ({ value }) => {
this.setState({
suggestions: getSuggestions(value,this.props.suggestions),
});
// this.setState({
// suggestions: getSuggestions(value,this.props.suggestions),
// });
};
handleSuggestionsClearRequested = () => {
this.setState({
suggestions: [],
});
// this.setState({
// suggestions: [],
// });
};
handleChange = (event, { newValue }) => {
......@@ -174,7 +174,7 @@ class IntegrationAutosuggest extends React.Component {
const { classes,setSearchTerm,suggestions } = this.props;
return (
<Paper className={classes.paperBackground}>
<Paper className={classes.paperBackground} elevation={3}>
<Autosuggest
theme={{
......
......@@ -6,7 +6,7 @@ import {facilities} from './api'
const reducers = combineReducers({
router:routerReducer,
ui,
facilities
facilities,
})
export default reducers;
import {TOGGLE_DRAWER,SET_SIDEBAR,SET_SEARCH_TERM,SET_FILTERED_LIST } from '../actions/action-types'
import {TOGGLE_DRAWER,SET_SIDEBAR,SET_SEARCH_TERM } from '../actions/action-types'
function isOpen(state=false,action){
switch (action.type) {
......@@ -24,13 +24,9 @@ const sidebar = (state={},action) => {
const searchbarState = {
term:'',
filteredList:[],
}
const filterList = (state) =>{
}
const search = (state=searchbarState,facilities=[],action) =>{
const search = (state=searchbarState,action) =>{
switch(action.type){
case SET_SEARCH_TERM:
return Object.assign({},state,{
......@@ -44,6 +40,6 @@ const search = (state=searchbarState,facilities=[],action) =>{
const ui = (state={},action) =>({
drawer:drawer(state.drawer,action),
sidebar:sidebar(state.sidbar,action),
search: search(state.search,state.facilities,action),
search: search(state.search,action),
})
export default ui;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment