import React from 'react';
import {View} from 'react-native';
import {IconDownload} from '@tabler/icons-react-native';
import {IconButton, Spinner} from '@components';

import {styles} from './styles';

interface Props {
  isDownloading: boolean;
  onPressDownload: () => void;
}

function HeaderRight({isDownloading, onPressDownload}: Props) {
  return isDownloading ? (
    <View style={styles.marginRight}>
      <Spinner />
    </View>
  ) : (
    <IconButton
      hitSlop={16}
      Icon={IconDownload}
      onPress={onPressDownload}
      variant="tertiary"
    />
  );
}

export default HeaderRight;
