forked from boacausa/webplatform
-
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.
Refs boacausa#114
- Loading branch information
Showing
17 changed files
with
176 additions
and
114 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
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,10 @@ | ||
export const types = { | ||
SET_SEX_FILTER: 'ADOPTION_FILTERS/SET_SEX_FILTER' | ||
}; | ||
|
||
const setSexFilter = (sex = '') => ({ | ||
type: types.SET_SEX_FILTER, | ||
sex | ||
}); | ||
|
||
export default setSexFilter; |
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,12 @@ | ||
import React from 'react'; | ||
import styles from './Button.sass'; | ||
|
||
const Button = (props) => ( | ||
<button | ||
children={props.children} | ||
className={styles.Button} | ||
onClick={props.onClick} | ||
/> | ||
); | ||
|
||
export default Button; |
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 |
---|---|---|
@@ -1,18 +1,16 @@ | ||
import React from 'react'; | ||
import styles from './SelectInput.sass'; | ||
|
||
const SelectInput = (props) => { | ||
return ( | ||
<div className={styles.SelectInput} style={{width: props.width, marginRight: props.marginRight}}> | ||
<label>{props.label}</label> | ||
<select name="color"> | ||
<option value="">{props.placeholder}</option> | ||
{props.options && props.options.length > 0 && props.options.map(opt => { | ||
return <option key={opt.id} value={opt.id}>{opt.name}</option> | ||
})} | ||
</select> | ||
</div> | ||
); | ||
}; | ||
const SelectInput = (props) => ( | ||
<div className={styles.SelectInput} style={{width: props.width, marginRight: props.marginRight}}> | ||
<label>{props.label}</label> | ||
<select name={props.name} onChange={props.onChange}> | ||
<option value="">{props.placeholder}</option> | ||
{props.options && props.options.length > 0 && props.options.map(opt => { | ||
return <option key={opt.id} value={opt.id}>{opt.name}</option> | ||
})} | ||
</select> | ||
</div> | ||
); | ||
|
||
export default SelectInput; |
10 changes: 0 additions & 10 deletions
10
app/javascript/components/SimpleSubmitButton/SimpleSubmitButton.jsx
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,31 +1,40 @@ | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import { createStore, combineReducers, applyMiddleware } from 'redux'; | ||
import thunk from 'redux-thunk'; | ||
import { composeWithDevTools } from 'redux-devtools-extension'; | ||
import adoptionFiltersReducer from './reducers/adoptionFilters' | ||
|
||
const initialState = { }; | ||
const appReducerDefaultState = { | ||
user: { email: null, group: null }, | ||
}; | ||
|
||
function rootReducer(state, action) { | ||
switch (action.type) { | ||
case "GET_NGOS_SUCCESS": | ||
return { ngos: action.json.ngos }; | ||
case "GET_NGO_SUCCESS": | ||
return { ngo: action.json.ngo }; | ||
case "GET_ADOPTION_SUCCESS": | ||
return { pets: action.json.pets }; | ||
case "GET_NGO_CITIES_SUCCESS": | ||
return { cities: action.json.cities }; | ||
default: | ||
return state; | ||
} | ||
function appReducer(state = appReducerDefaultState, action) { | ||
switch (action.type) { | ||
case "GET_NGOS_SUCCESS": | ||
return { ...state, ngos: action.json.ngos }; | ||
case "GET_NGO_SUCCESS": | ||
return { ...state, ngo: action.json.ngo }; | ||
case "GET_ADOPTION_SUCCESS": | ||
return { ...state, pets: action.json.pets }; | ||
case "GET_NGO_CITIES_SUCCESS": | ||
return { ...state, cities: action.json.cities }; | ||
default: | ||
return state; | ||
} | ||
} | ||
|
||
export default function configureStore() { | ||
const store = createStore( | ||
rootReducer, | ||
initialState, | ||
composeWithDevTools( | ||
applyMiddleware(thunk) | ||
) | ||
); | ||
return store; | ||
} | ||
const rootReducer = combineReducers({ | ||
app: appReducer, | ||
adoptionFilters: adoptionFiltersReducer | ||
}); | ||
|
||
export default function configureStore(user) { | ||
const preloadedState = { app: { user } }; | ||
|
||
const store = createStore( | ||
rootReducer, | ||
preloadedState, | ||
composeWithDevTools(applyMiddleware(thunk)) | ||
); | ||
|
||
return store; | ||
}; |
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
Oops, something went wrong.