import React from 'react';
import {ProfilePreviewType, PreviewType, ScreenType} from '../../types';
import ProfilePreview from '../profile/ProfilePreview';
import {StyleSheet, View} from 'react-native';
interface SearchResultsProps {
  results: Array<ProfilePreviewType>;
  previewType: PreviewType;
  screenType: ScreenType;
}
const SearchResults: React.FC<SearchResultsProps> = ({
  results,
  previewType,
  screenType,
}) => {
  return (
    <View style={styles.container}>
      {results.map((profilePreview) => (
        <ProfilePreview
          style={styles.result}
          key={profilePreview.id}
          {...{profilePreview}}
          previewType={previewType}
          screenType={screenType}
        />
      ))}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {flexDirection: 'row', flexWrap: 'wrap'},
  result: {
    marginVertical: 10,
  },
});

export default SearchResults;
