Skip to content
Snippets Groups Projects
Forked from GéoContrib / Géocontrib Frontend
1032 commits behind the upstream repository.
MessageInfo.vue 1.95 KiB
<template>
  <transition name="fadeDownUp">
    <div
      v-if="messages && messages.length > 0"
      class="row over-content"
    >
      <div class="fourteen wide column">
        <div
          v-for="(message, index) in messages"
          :key="'message-' + index"
          :class="['ui', message.level ? message.level : 'info', 'message']"
        >
          <i
            class="close icon"
            aria-hidden="true"
            @click="DISCARD_MESSAGE(message)"
          />
          <div class="header">
            <i
              class="info circle icon"
              aria-hidden="true"
            />
            Informations
          </div>
          <ul class="list">
            {{
              message.comment
            }}
          </ul>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
import { mapState, mapMutations } from 'vuex';

export default {
  name: 'MessageInfo',

  computed: {
    ...mapState(['messages']),
  },

  methods: {
    ...mapMutations(['DISCARD_MESSAGE']),
  },
  
};
</script>

<style>
.row.over-content {
  position: absolute; /* to display message info over page content */
  z-index: 99;
  opacity: 0.95;
  width: calc(100% - 4em); /* 4em is #content left + right paddings */
  top: calc(61px + 1em); /* 61px is #app-header height */
  right: 2em; /* 2em is #content left paddings */
}

.fadeDownUp-enter-active {
  animation: fadeInDown .5s;
}
.fadeDownUp-leave-active {
  animation: fadeOutUp .5s;
}
@keyframes fadeOutUp {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(0, -100%, 0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -100%, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.ui.message > .close.icon {
  cursor: pointer;
  position: absolute;
  margin: 0em;
  top: 0.78575em;
  right: 0.5em;
  opacity: 0.7;
  -webkit-transition: opacity 0.1s ease;
  transition: opacity 0.1s ease;
}
</style>