1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00
5e-drs/docs/.vuepress/theme/global-components/SpellTooltip.vue
2020-04-05 16:23:27 +02:00

64 lines
2.3 KiB
Vue

<template>
<span>
<router-link :to="{ path: spellPath }" v-if="spell">
<v-tooltip content-class="spell-tooltip-container" top>
<template v-slot:activator="{ on }">
<em v-on="on">{{ label }}</em>
</template>
<div class="spell-tooltip">
<p class="spell-tooltip-title"><strong>{{ spell.title }}</strong></p>
<div class="spell-details">
<div class="spell-school-level" v-html="displaySchoolLevel()"></div>
<div class="spell-casting-time"><strong>Temps d'incantation</strong> : {{ spell.frontmatter.casting_time }}</div>
<div class="spell-range"><strong>Portée</strong> : {{ spell.frontmatter.range }}</div>
<div class="spell-components"><strong>Composantes</strong> :
<template v-if="spell.frontmatter.components.verbal">V</template><template v-if="spell.frontmatter.components.somatic || spell.frontmatter.components.material">,</template>
<template v-if="spell.frontmatter.components.somatic">S</template><template v-if="spell.frontmatter.components.material">,</template>
<template v-if="spell.frontmatter.components.material">M</template>
<template v-if="spell.frontmatter.components.materials">({{spell.frontmatter.components.materials}})</template>
</div>
<div class="spell-duration"><strong>Durée</strong> : <span v-if="spell.frontmatter.concentration">concentration, </span>{{ spell.frontmatter.duration }}</div>
</div>
<div class="spell-description">{{ spell.frontmatter.description }}</div>
</div>
</v-tooltip>
</router-link>
<router-link :to="{ path: spellPath }" v-else>{{ label }}</router-link>
</span>
</template>
<script>
import {displaySchoolLevel} from '@theme/util/spellHelpers'
export default {
name: 'SpellTooltip',
props: [
'label',
'path'
],
data () {
return {
spellPath: '',
spell: ''
}
},
methods: {
displaySchoolLevel () {
return displaySchoolLevel(this.spell.frontmatter)
}
},
mounted () {
console.log(this.path)
this.spellPath = '/grimoire/' + this.path + '/'
this.spell = this.$site.pages.find((el) => el.path === this.spellPath || el.path === this.spellPath + "/")
console.log(this.spell)
}
}
</script>
<style lang="scss">
</style>