<template>
  <div class="masonry text-white">
    <figure v-for="file in files">
      <a :href="'https://files.erudi.fr/screenshit/' + file" target="_blank">
        <img :src="'https://files.erudi.fr/screenshit/' + file">
        {{ file }}
      </a>
    </figure>
  </div>
</template>

<script setup>
const { data: files } = await useFetch('/api/screenshit')
</script>

<style>
body {
  background-color: #000;
  font: 1.1em Arial, Helvetica, sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

figure {
  margin: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}

figure>img {
  grid-row: 1 / -1;
  grid-column: 1;
}

figure a {
  color: black;
  text-decoration: none;
}

figcaption {
  grid-row: 2;
  grid-column: 1;
  background-color: rgba(255, 255, 255, .5);
  padding: .2em .5em;
  justify-self: start;
}

.masonry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
  gap: 10px;
}

.landscape {
  grid-column-end: span 2;
}
</style>