import cn from 'classnames';
import React, { FC } from 'react';
import { TouchableOpacity, Text } from 'react-native';

import button from './IconButton.styles';

type props = {
  classNames?: string;
  children: React.ReactNode;
  variant: 'primary' | 'secondary';
  onPress: () => void;
};

const IconButton: FC<props> = ({ children, variant, onPress, classNames }) => {
  const variantClasses = button.variant[variant];
  return (
    <TouchableOpacity className="p-1" onPress={onPress}>
      <Text className={cn(variantClasses.text, classNames)}>{children}</Text>
    </TouchableOpacity>
  );
};

export default IconButton;
