<template>
  <div class="background-image-loader">
    <div class="background-container">
      <div class="background background-loading"
           :style="loadingStyle"></div>
      <div class="background background-img"
           :style="backgroundStyle"></div>
    </div>
  </div>
</template>

<script>
import imageLoader from '~/mixins/imageLoader.js'

export default {
  mixins: [ imageLoader ],

  props: {
    bgLoading: {
      type: String,
      required: false,
      default: function () {
        return 'linear-gradient(310deg, #35405d, #6174aa, #a8b3d0, #e2e5ef)'
      }
    },
    img: {
      type: String,
      required: false,
      default: function () {
        return 'url(https://via.placeholder.com/1920x1080)'
      }
    },
  },

  data () {
    return {
    }
  },

  computed: {
    loadingStyle () {
      return {
        background: this.bgLoading
      }
    },
    backgroundStyle () {
      return {
        backgroundImage: this.img
      }
    }
  },

  methods: {
  }
}
</script>

<style lang="scss" scoped>

.background-image-loader {
  position: relative;
  width: 100%;
  height: 100%;
}

.background {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.background-img {
  background-size: cover;
  background-position: center center;
  opacity: .5;
}
</style>
