<template>
  <div>
    <div class="gallery-thumbs__spacer"></div>
    <ul class="gallery-thumbs__list">
      <li v-for="(gallery, index) in galleries"
          :key="index">
        <ul class="gallery-thumbs__row">
          <li class="featured-image mobile-only"
              :style="{ 'height': featuredHeight }">
            <ThumbNav direction="right" />
          </li>
          <li v-for="image in gallery.images"
              class="thumb-container"
              :key="image.url">
            <ThumbNav direction="left" />
            <ThumbNav direction="right" />
            <span>{{ image.thumbUrl }}</span>
          </li>
        </ul>
      </li>
    </ul>
  </div>
</template>

<script>
import ThumbNav from '@/components/ThumbNav'

export default {
  components: {
    ThumbNav
  },
  
  props: {
    galleries: {
      type: Array,
      required: true
    },
    featuredHeight: {
      type: String,
      required: true
    }
  },

  data () {
    return {
      activeThumbIndices: []
    }
  },

  mounted () {
    console.log('mounted')
  },

  methods: {
    slideRight(index) {
      console.log('slideRight: ', index)
    }
  }
}
</script>

<style lang="scss" scoped>
.gallery-thumbs__row {
  display: flex;
  flex-direction: row;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (max-width: $bp__layout) {
  .gallery-thumbs__spacer {
    display:none;
  }

  .gallery-thumbs__row {
    position: relative;
  }

  .gallery-thumbs__slider {
    position: absolute;
    width: 10rem;
    height: 10rem;
    bottom: 1rem;
    left: 100vw;
    transform: translateX( calc(-2rem - 100%));
  }

  .featured-image {
    height: 50vh !important; // must override inline style set with prop
    width: 100vw;
    flex: 0 0 100vw;
  }

  .thumb-container {
    height: 50vh;
    width: 100vw;
  }
}

@media (min-width: $bp__layout) {
  $thumbs-height: 8rem;

  .mobile-only {
    display: none;
  }

  .featured-image {
    width: 100%;
  }

  .thumb-container {
    height: $thumbs-height;
  }

  .gallery-thumbs__list {
    height: $thumbs-height;

    overflow: hidden;
  }

  .gallery-thumbs__row {
    flex: 0 0 $thumbs-height;
  }

  .thumb-nav {
    display: none;
  }
}

</style>
