diff options
| author | Leon Jiang <35908040+leonyjiang@users.noreply.github.com> | 2021-03-08 05:49:55 -0500 |
|---|---|---|
| committer | Leon Jiang <35908040+leonyjiang@users.noreply.github.com> | 2021-03-08 05:49:55 -0500 |
| commit | 32bf3bf2cfa2f4499711225b2f1da5f3ed274832 (patch) | |
| tree | afda39ec93e2b59356b0b5e5486fc401b4c4d34e /src/components/search/RecentSearches.tsx | |
| parent | 1d4dd2b2e6496374063efe7a4e1f8bde5cab32b1 (diff) | |
Add categories to recently-searched results
Diffstat (limited to 'src/components/search/RecentSearches.tsx')
| -rw-r--r-- | src/components/search/RecentSearches.tsx | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/components/search/RecentSearches.tsx b/src/components/search/RecentSearches.tsx index 5db1342c..89379596 100644 --- a/src/components/search/RecentSearches.tsx +++ b/src/components/search/RecentSearches.tsx @@ -7,7 +7,12 @@ import { TouchableOpacityProps, ScrollView, } from 'react-native'; -import {PreviewType, ProfilePreviewType, ScreenType} from '../../types'; +import { + PreviewType, + ProfilePreviewType, + ScreenType, + CategoryPreviewType, +} from '../../types'; import {TAGG_LIGHT_BLUE} from '../../constants'; import SearchResults from './SearchResults'; import {SCREEN_HEIGHT} from '../../utils'; @@ -16,26 +21,35 @@ interface RecentSearchesProps extends TouchableOpacityProps { sectionTitle: PreviewType; sectionButtonTitle: string; recents: Array<ProfilePreviewType>; + recentCategories: CategoryPreviewType[]; screenType: ScreenType; } const RecentSearches: React.FC<RecentSearchesProps> = (props) => { + const { + sectionTitle, + sectionButtonTitle, + recents, + recentCategories, + screenType, + } = props; return ( <ScrollView style={styles.mainContainer} contentContainerStyle={{paddingBottom: SCREEN_HEIGHT * 0.1}}> <View style={styles.container}> - <Text style={styles.title}>{props.sectionTitle}</Text> - {props.sectionButtonTitle && ( + <Text style={styles.title}>{sectionTitle}</Text> + {sectionButtonTitle && ( <TouchableOpacity {...props}> <Text style={styles.clear}>Clear all</Text> </TouchableOpacity> )} </View> <SearchResults - results={props.recents} - previewType={props.sectionTitle} - screenType={props.screenType} + results={recents} + categories={recentCategories} + previewType={sectionTitle} + screenType={screenType} /> </ScrollView> ); @@ -44,7 +58,6 @@ const RecentSearches: React.FC<RecentSearchesProps> = (props) => { const styles = StyleSheet.create({ mainContainer: { marginLeft: '3%', - padding: 20, }, container: { flexDirection: 'row', |
