import React from 'react';
import { File } from './FileProps';
import { FilePreview } from './FilePreview';
import { Box } from '@wix/design-system';

export interface FileCardListProps {
  files: File[];
  showDownloadCTA?: boolean;
  showDetails?: boolean;
}

export const FileCardList = ({
  files,
  showDownloadCTA,
  showDetails,
}: FileCardListProps) => {
  if (!files) {
    return null;
  }
  return (
    <Box direction="vertical">
      {files.map((file) => (
        <FilePreview
          file={file}
          key={file.mediaId}
          showDownloadCTA={showDownloadCTA}
          showDetails={showDetails}
        />
      ))}
    </Box>
  );
};
