aboutsummaryrefslogtreecommitdiff
path: root/src/components/search/RecentSearches.tsx
blob: bebf6bcfa1ad64fd7a95c50f6390644f2bc2b7de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  StyleSheet,
  TouchableOpacityProps,
} from 'react-native';
import {PreviewType, ProfilePreviewType, ScreenType} from '../../types';
import {TAGG_LIGHT_BLUE} from '../../constants';
import SearchResults from './SearchResults';

interface RecentSearchesProps extends TouchableOpacityProps {
  sectionTitle: PreviewType;
  sectionButtonTitle: string;
  recents: Array<ProfilePreviewType>;
  screenType: ScreenType;
}
/**
 * An image component that returns the <Image> of the icon for a specific social media platform.
 */
const RecentSearches: React.FC<RecentSearchesProps> = (props) => {
  return (
    <View style={styles.mainContainer}>
      <View style={styles.container}>
        <Text style={styles.title}>{props.sectionTitle}</Text>
        {props.sectionButtonTitle && (
          <TouchableOpacity {...props}>
            <Text style={styles.clear}>Clear all</Text>
          </TouchableOpacity>
        )}
      </View>
      <SearchResults
        results={props.recents}
        previewType={props.sectionTitle}
        screenType={props.screenType}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  mainContainer: {
    marginLeft: '3%',
  },
  container: {
    flexDirection: 'row',
  },
  title: {
    fontSize: 18,
    fontWeight: '600',
    flexGrow: 1,
    marginBottom: '5%',
  },
  clear: {
    fontSize: 18,
    fontWeight: 'bold',
    color: TAGG_LIGHT_BLUE,
  },
});

export default RecentSearches;