/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */
import React from 'react';
import {
  Header,
  Left,
  Button,
  Icon,
  Right,
  Text,
  Body,
  Title,
  Subtitle,
} from 'native-base';
import styles from './styles';

const Headercontent = (props: any) => {
  const {
    onPress,
    textHeadr,
    onPressToPage,
    type,
    name,
    loginTitle,
    rightIcon,
    rightType,
    stylesRight,
    onPressToCart,
    addressTitle,
    iconName,
    iconType,
    onPressToSearch,
    searchIcon,
    searchIconType,
    editIcon,
  } = props;

  return (
    <Header style={styles.headerLogin}>
      <Left style={styles.flexOne}>
        <Button transparent onPress={onPress}>
          <Icon name={name} style={styles.back} type={type} />
        </Button>
      </Left>

      <Body style={styles.flexOneTitle}>
        {loginTitle && <Title style={styles.colorWhit}>{loginTitle}</Title>}
        {addressTitle && (
          <Subtitle style={styles.subtitleText}>
            {addressTitle}{' '}
            <Icon name={iconName} type={iconType} style={editIcon} />
          </Subtitle>
        )}
      </Body>

      <Right style={styles.flexOne}>
        {onPressToPage && (
          <Button transparent onPress={onPressToPage}>
            <Text style={styles.buttonText}>{textHeadr}</Text>
          </Button>
        )}
        {searchIcon && (
          <Button transparent onPress={onPressToSearch}>
            <Icon name={searchIcon} type={searchIconType} style={stylesRight} />
          </Button>
        )}
        {rightIcon && (
          <Button transparent onPress={onPressToCart}>
            <Icon name={rightIcon} type={rightType} style={stylesRight} />
          </Button>
        )}
      </Right>
    </Header>
  );
};
export default Headercontent;
