import Stack from '@material-hu/mui/Stack/Stack';
import { FileAsset } from '@material-hu/types/attachments';

import FileCard from '@material-hu/components/design-system/FileCard';

type Props = {
  attachments: FileAsset[];
};

const ComponentAttachments = ({ attachments }: Props) => {
  if (!attachments.length) return null;

  return (
    <Stack sx={{ gap: 1 }}>
      {attachments.map(attachment => (
        <FileCard
          status="success"
          key={attachment.id}
          fileAsset={attachment}
          sx={{ width: '100%' }}
        />
      ))}
    </Stack>
  );
};

export default ComponentAttachments;
