-
Notifications
You must be signed in to change notification settings - Fork 1
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 #117 from social-native/feat/add-raw-query-filter
Feat/add raw query filter
- Loading branch information
Showing
9 changed files
with
449 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, {useContext, useState} from 'react'; | ||
import Context from '../context'; | ||
|
||
export type QueryStringFilterProps = { | ||
field: string | ||
} | ||
|
||
// tslint:disable-next-line:variable-name | ||
const QueryStringFilter: React.FC<QueryStringFilterProps> = (props) => { | ||
const { field } = props; | ||
const creatorCRM = useContext(Context.creatorCRM); | ||
const [queryStringInput, setQueryStringInput] = useState<string>(''); | ||
|
||
const { | ||
filters: {queryString: queryStringFilter} | ||
} = creatorCRM; | ||
|
||
return ( | ||
<div style={{display: 'flex', flexDirection: 'column'}}> | ||
<div>Query String Filter for {field}</div> | ||
<br/> | ||
<label htmlFor={'queryString'}> | ||
Query String | ||
<br/> | ||
<input | ||
name={'queryString'} | ||
id={'queryString'} | ||
value={queryStringInput} | ||
onChange={({ target: { value } }) => setQueryStringInput(value)} | ||
/> | ||
</label> | ||
<br/> | ||
<button onClick={() => queryStringFilter.setFilter(field, { query: queryStringInput, inclusion: 'must' })}>Apply</button> | ||
</div> | ||
); | ||
}; | ||
export default QueryStringFilter |
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
Oops, something went wrong.