<!--
   Copyright 2018 Brigham Young University

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<template>
  <div :class="badgeClass">
    <Spinner text="Loading..." />
  </div>
</template>
<script>
  import { mapGetters } from 'vuex'
  import Spinner from './Spinner'

  export default {
    name: 'LoadingBadge',
    components: { Spinner },
    computed: {
      ...mapGetters(['loading']),
      badgeClass () {
        return {
          'card': true,
          'content-padding': true,
          'bg-secondary': true,
          'text-light': true,
          'loading-badge': true,
          'hidden': !this.loading
        }
      }
    }
  }
</script>
<style scoped>
  .loading-badge {
    opacity: 1;
    transform: translateX(0);
    position: absolute;
    top: 6.5rem;
    left: 2rem;
    transition: all 250ms ease;
    z-index: 9999;
    box-shadow: 0 0 1rem #3333;
  }
  .hidden {
    opacity: 0;
    transform: translateX(-20rem);
  }
</style>
