import React from 'react'

import Icon from '../../Icons/Icon'
import { type IconStringList } from '../../Icons/Icon.models'
import styles from './_download-loader.module.scss'

type DownloadLoaderProps = {
  /** Optionally change the icon */
  customIcon?: IconStringList
  /** Optional className */
  customClass?: string
  /** Optional prop to add a test id to the DownloadLoader for QA testing */
  qaTestId?: string
}
const DownloadLoader = ({
  customIcon = 'refresh',
  customClass = '',
  qaTestId = 'download-loader',
}: DownloadLoaderProps): React.JSX.Element => {
  return (
    <div
      className={`${styles.downloadLoaderContainer} ${customClass}`}
      qa-test-id={qaTestId}
    >
      <Icon icon={customIcon} iconSize='20px' className={styles.rotate} />
    </div>
  )
}

export default DownloadLoader
