// @flow
import React from 'react';
import { View } from 'react-native';
import styles from './ListItemLeft.styles';
import { Avatar, Icon } from '../';

type Props = {
  avatar: {
    imageUrl: string,
    description: string,
  },
  icon: string,
};

const ListItemLeft = ({ avatar, icon }: Props) => (
  <View style={styles.listLeft}>
    {avatar.imageUrl
      ? <Avatar imageUrl={avatar.imageUrl} description={avatar.description} />
      : !!icon && <Icon name={icon} />
    }
  </View>
);

ListItemLeft.defaultProps = {
  avatar: {
    imageUrl: '',
    description: '',
  },
  icon: '',
};

export default ListItemLeft;
