Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): event list filter by acked at
- Loading branch information
Guillaume Louvigny
committed
Nov 7, 2018
1 parent
f7db7f9
commit 30079ef
Showing
19 changed files
with
466 additions
and
219 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react' | ||
import { StackActions } from 'react-navigation' | ||
import ModalScreen from './ModalScreen' | ||
import { Switch, Text } from 'react-native' | ||
import { Rows, Cols } from './Flex' | ||
import { Text as FlexText } from './Text' | ||
import Button from './Button' | ||
import { padding } from '../../styles' | ||
|
||
export class FilterModal extends React.Component { | ||
constructor (props) { | ||
super(props) | ||
|
||
this.state = { | ||
...this.props.defaultData, | ||
} | ||
} | ||
|
||
onDismiss = () => { | ||
this.resetState() | ||
this.close() | ||
} | ||
|
||
onFilter = () => { | ||
const onSave = this.props.navigation.getParam('onSave') | ||
|
||
if (!onSave) { | ||
console.error('onSave is not defined') | ||
} | ||
|
||
onSave(this.state) | ||
|
||
this.close() | ||
} | ||
|
||
close = () => { | ||
this.props.navigation.dispatch(StackActions.pop({ | ||
n: 1, | ||
})) | ||
} | ||
|
||
resetState = () => { | ||
this.setState({ | ||
...this.state, | ||
...this.props.defaultData, | ||
}) | ||
} | ||
|
||
render = () => <ModalScreen navigation={this.props.navigation} onDismiss={() => this.onDismiss()}> | ||
<Rows style={[padding]} align='center'> | ||
{this.props.title ? <Text>{this.props.title}</Text> : null} | ||
{React.Children.map(this.props.children, child => React.cloneElement(child, { | ||
onChange: value => this.setState({ [child.props.name]: value }), | ||
value: this.state[child.props.name], | ||
}))} | ||
<Cols> | ||
<Button onPress={() => this.onDismiss()}>Cancel</Button> | ||
<Button onPress={() => this.onFilter()}>Filter</Button> | ||
</Cols> | ||
</Rows> | ||
</ModalScreen> | ||
} | ||
|
||
// Impl for this is really bad, move to radio buttons instead | ||
export const PickerFilter = ({ value, onChange, choices }) => <Rows style={{ flex: 1, width: '100%' }}> | ||
{choices.map(({ value: choiceValue, label }) => | ||
<Cols size={1} key={choiceValue}> | ||
<Switch value={value === choiceValue} onValueChange={() => onChange(choiceValue)} style={{ width: 50 }} /> | ||
<FlexText>{label}</FlexText> | ||
</Cols>, | ||
)} | ||
</Rows> |
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
28 changes: 28 additions & 0 deletions
28
client/react-native/common/components/Library/SearchBar.js
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 { paddingBottom, paddingLeft, paddingRight } from '../../styles' | ||
import { TextInput, Platform } from 'react-native' | ||
import { colors } from '../../constants' | ||
import React from 'react' | ||
import { Flex } from '.' | ||
|
||
export default props => <Flex.Cols size={1} style={[paddingBottom]}> | ||
<TextInput | ||
underlineColorAndroid='transparent' | ||
autoCorrect={(props.autoCorrect !== undefined && props.autoCorrect) || false} | ||
style={[ | ||
...(props.style || []), | ||
{ | ||
height: 36, | ||
flex: 1, | ||
backgroundColor: colors.grey7, | ||
borderWidth: 0, | ||
borderRadius: 18, | ||
...(Platform.OS === 'web' ? { outline: 'none' } : {}), | ||
}, | ||
paddingLeft, | ||
paddingRight, | ||
]} | ||
placeholder={props.placeholder !== undefined ? props.placeholder : 'Search...'} | ||
onChangeText={props.onChangeText} | ||
/> | ||
{props.children} | ||
</Flex.Cols> |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.