diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-03-08 19:54:42 -0500 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-03-08 19:54:42 -0500 |
| commit | f899dc058f90813c5ae71e55407a11e6ca13e1ed (patch) | |
| tree | 84c93e869fab6d434d6709dc1d471c6e588c4e4e /src/components/search/RecentSearches.tsx | |
| parent | 8837ea74dbff9cf455cd7cb092767e51de3900f8 (diff) | |
| parent | d77f43663fbe409b011b5509bcbff3d07f8ded55 (diff) | |
Merge branch 'master' into tma684-search-for-badges
# Conflicts:
# src/components/search/SearchResultCell.tsx
# src/components/search/SearchResultList.tsx
Diffstat (limited to 'src/components/search/RecentSearches.tsx')
| -rw-r--r-- | src/components/search/RecentSearches.tsx | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/src/components/search/RecentSearches.tsx b/src/components/search/RecentSearches.tsx index 6fb9fca9..b4cc5483 100644 --- a/src/components/search/RecentSearches.tsx +++ b/src/components/search/RecentSearches.tsx @@ -7,37 +7,45 @@ 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'; interface RecentSearchesProps extends TouchableOpacityProps { sectionTitle: PreviewType; - sectionButtonTitle: string; recents: Array<ProfilePreviewType>; + recentCategories: CategoryPreviewType[]; screenType: ScreenType; } -/** - * An image component that returns the <Image> of the icon for a specific social media platform. - */ + const RecentSearches: React.FC<RecentSearchesProps> = (props) => { + const { + sectionTitle, + 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 && ( - <TouchableOpacity {...props}> - <Text style={styles.clear}>Clear all</Text> - </TouchableOpacity> - )} + contentContainerStyle={styles.contentContainer}> + <View style={styles.header}> + <Text style={styles.title}>{sectionTitle}</Text> + <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> ); @@ -45,17 +53,20 @@ const RecentSearches: React.FC<RecentSearchesProps> = (props) => { const styles = StyleSheet.create({ mainContainer: { - marginLeft: '3%', - padding: 20, + flexGrow: 1, + }, + contentContainer: { + paddingBottom: SCREEN_HEIGHT * 0.1, }, - container: { + header: { + paddingHorizontal: 25, + paddingVertical: 5, flexDirection: 'row', }, title: { fontSize: 18, fontWeight: '600', flexGrow: 1, - marginBottom: '5%', }, clear: { fontSize: 18, |
