-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from p632-sp-2017/filtering
Filtering
- Loading branch information
Showing
13 changed files
with
253 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { createAction } from 'redux-actions'; | ||
import { TOGGLE_DRAWER, SORT_ACTION_LIST, SELECT_DROPDOWN_OPTION } from './types'; | ||
import { TOGGLE_DRAWER, SORT_ACTION_LIST, FILTER_ACTION_LIST, RESET_FILTERS, SELECT_DROPDOWN_OPTION } from './types'; | ||
|
||
export const toggleDrawer = createAction(TOGGLE_DRAWER); | ||
export const filterActionList = createAction(FILTER_ACTION_LIST); | ||
export const sortActionList = createAction(SORT_ACTION_LIST); | ||
export const selectDropdownOption = createAction(SELECT_DROPDOWN_OPTION); | ||
export const resetFilters = createAction(RESET_FILTERS); |
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,3 +1,5 @@ | ||
export const TOGGLE_DRAWER = 'toggle_drawer'; | ||
export const FILTER_ACTION_LIST = 'filter_action_list'; | ||
export const SORT_ACTION_LIST = 'sort_action_list'; | ||
export const SELECT_DROPDOWN_OPTION = 'select_dropdown_option'; | ||
export const RESET_FILTERS = 'reset_filters'; |
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 |
---|---|---|
|
@@ -59,4 +59,3 @@ ActionItemHeader.propTypes = { | |
}; | ||
|
||
export default ActionItemHeader; | ||
|
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 from 'react'; | ||
import { | ||
StyleSheet, | ||
View, | ||
Text, | ||
} from 'react-native'; | ||
import { Colors } from '../lib/commons'; | ||
|
||
const style = StyleSheet.create({ | ||
headerText: { | ||
fontSize: 10, | ||
color: Colors.iuCrimson, | ||
fontFamily: 'BentonSansBold, Arial, sans-serif', | ||
margin: 10, | ||
}, | ||
}); | ||
|
||
const ContentHeader = props => ( | ||
<View> | ||
<Text style={style.headerText}>{props.children}</Text> | ||
</View> | ||
); | ||
|
||
ContentHeader.propTypes = { | ||
children: React.PropTypes.node.isRequired, | ||
}; | ||
|
||
export default ContentHeader; |
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,43 @@ | ||
import React from 'react'; | ||
import { | ||
View, | ||
Picker, | ||
} from 'react-native'; | ||
|
||
/* eslint-disable no-unused-vars */ | ||
import { connect } from 'react-redux'; | ||
import { filterActionList } from '../actions/action_items'; | ||
import ContentHeader from './contentHeader'; | ||
|
||
const FilterPicker = ({ filter, value, filterKey, onActionListFiltering }) => ( | ||
<View> | ||
<ContentHeader>{filter.title}</ContentHeader> | ||
<Picker | ||
selectedValue={value} | ||
onValueChange={selectedOption => onActionListFiltering(filterKey, selectedOption)} | ||
> | ||
{ | ||
filter.data.map(i => ( | ||
<Picker.Item value={i} label={i} key={i} /> | ||
)) | ||
} | ||
</Picker> | ||
</View> | ||
); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
onActionListFiltering: (filterType, value) => | ||
dispatch(filterActionList({ filterType, value })), | ||
}); | ||
|
||
FilterPicker.propTypes = { | ||
onActionListFiltering: React.PropTypes.func.isRequired, | ||
filter: React.PropTypes.shape({ | ||
title: React.PropTypes.string, | ||
data: React.PropTypes.arrayOf(React.PropTypes.string), | ||
}).isRequired, | ||
value: React.PropTypes.string.isRequired, | ||
filterKey: React.PropTypes.string.isRequired, | ||
}; | ||
|
||
export default connect(null, mapDispatchToProps)(FilterPicker); |
Large diffs are not rendered by default.
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
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