import { useFetch } from 'hooks/useFetch';

type DemoFile = {
  name: string;
  url: string;
};

const DEMO_FILES_URL =
  'https://fansifter-public-resources.s3-eu-west-1.amazonaws.com/index.json';

export const UploadFooter = () => {
  const { data } = useFetch<DemoFile[]>(DEMO_FILES_URL);

  if (data) {
    return (
      <div
        className="fz14 tac padding4 spacing2"
        style={{ background: 'antiquewhite' }}
      >
        <span>Try it out with our demo files:</span>
        {data.map((file) => {
          return (
            <a href={file.url} download key={file.url}>
              {file.name}
            </a>
          );
        })}
      </div>
    );
  } else {
    return null;
  }
};
