<template>
  <div class="gallery-page">
    <div class="image-viewer"
         :class="{ 'is-visible': imageViewerIsVisible }">
      <div class="close-viewer"
           @click="toggleImageViewer">
        X
      </div>
    </div>
    <div class="gallery-container">
      <GalleryFeatured :galleries="galleries" />
      <GalleryThumbs :galleries="galleries" />
    </div>
  </div>
</template>

<script>
import GalleryFeatured from '@/components/GalleryFeatured'
import GalleryThumbs from '@/components/GalleryThumbs'

export default {
  components: {
    GalleryFeatured,
    GalleryThumbs
  },

  props: {
    galleries: {
      type: Array,
      required: true
    }
  },

  data () {
    return {
      imageViewerIsVisible: false
    }
  },

  methods: {
    toggleImageViewer () {
      this.imageViewerIsVisible = !this.imageViewerIsVisible;
    }
  }
}
</script>

<style lang="scss" scoped>
.gallery-page {
  position: relative;
  height: 100%;
  width: 100%;
}

.image-viewer {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(
  to bottom left,
  magenta,
  cyan
  );
}

@media (max-width: $bp__layout) {
  $gallery-thumb-slider-width: 10rem;

  .gallery-page {
    padding-top: $site-menu__header-height;
  }

  .gallery-container {
    position: relative;
    height: 100%;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .close-viewer {
    font-size: 10em;
    cursor: pointer;
  }

  .image-viewer {
    z-index: 50;

    transition: opacity 1s; //TEMP
    opacity: 0;
    pointer-events: none;

    &.is-visible {
      opacity: 1;
      pointer-events: auto;
    }
  }
}

@media (min-width: $bp__layout) {
  .mobile-only {
    display: none;
  }

  .gallery-page {
    padding-left: $site-menu__header-width;
  }

  .gallery-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
  }

  .close-viewer {
    display: none;
  }

}

</style>
