summaryrefslogtreecommitdiff
path: root/src/TalentImage.vue
blob: b52887ed498692a58e304d0a88ff7b5ced133ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
  <div v-if="rarity !== 'unknown' && rarity" class="talent-image" :style="`background-image: url('dist/assets/talent-icons-small/${hero}/${hero}_${rarity}.png'); width: ${size}px; height: ${size}px`">
  </div>
</template>

<style scoped>
  .talent-image {
    /* background-color: red; */
    background-size: 150px;
    border-radius: 50%;
    background-position: center center;
  }
</style>


<script>
import Vue from 'vue';
import * as maps from './maps/maps';

export default Vue.component('talent-image', {
  props: [ 'entry', 'size' ],
  data: function() {
    return {
      hero: maps.getHero(this.entry.Actor),
      rarity: maps.getTalentRarity(this.entry.Talent),
    };
  },
  
  watch: {
    entry: function(newEntry, oldEntry) {
      // This is needed so component will recalculate whenever there is a change on entry
      this.hero = maps.getHero(this.entry.Actor);
      this.rarity = maps.getTalentRarity(this.entry.Talent);
    } 
  }
});
</script>