This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/frontend/src/components/Card.vue

101 lines
2.2 KiB
Vue
Raw Normal View History

2019-05-14 23:13:44 +00:00
<template>
<v-list-tile avatar>
2019-05-15 00:05:53 +00:00
<v-tooltip @input="booted = true" bottom>
2019-05-14 23:39:16 +00:00
<template v-slot:activator="{ on }">
2019-05-24 09:26:02 +00:00
<v-list-tile-avatar v-on="on" style="cursor: zoom-in">
2019-05-16 06:09:43 +00:00
<svg
x="0px"
y="0px"
width="16px"
height="30px"
viewBox="0 0 16 30"
2019-05-24 09:26:02 +00:00
style="enable-background:new 0 0 16 30"
2019-05-16 06:09:43 +00:00
xml:space="preserve"
>
<polygon points="0,5 8,0 16,5 16,25 8,30 0,25" :fill="color" />
<text
x="2.5"
y="22"
font-size="20"
font-family="sans-serif"
fill="white"
font-weight="bold"
class="ng-binding"
>
{{ dbentry.cost }}
</text>
</svg>
2019-05-14 23:39:16 +00:00
</v-list-tile-avatar>
</template>
2019-05-15 00:05:53 +00:00
<v-img
v-if="booted"
:src="ffiurl"
:height="300"
:width="0.715 * 300"
contain
/>
2019-05-14 23:39:16 +00:00
</v-tooltip>
2019-05-14 23:13:44 +00:00
<v-list-tile-content>
<v-list-tile-title class="body-2">{{ dbentry.name }}</v-list-tile-title>
2019-05-14 23:39:16 +00:00
<v-list-tile-sub-title>{{ full_serial }}</v-list-tile-sub-title>
2019-05-14 23:13:44 +00:00
</v-list-tile-content>
<v-list-tile-avatar>
<span class="subheading">{{ count }}</span>
</v-list-tile-avatar>
</v-list-tile>
</template>
<script>
export default {
name: 'Card',
props: {
count: Number,
serial: String,
dbentry: Object
},
2019-05-15 00:05:53 +00:00
data: () => ({
booted: false
}),
2019-05-14 23:13:44 +00:00
computed: {
color() {
switch (this.dbentry.element.toLowerCase()) {
case 'fire':
return '#d41'
case 'ice':
return '#7ac'
case 'wind':
return '#596'
case 'earth':
return '#db1'
case 'lightning':
return '#859'
case 'water':
return '#57a'
case 'light':
return '#888'
case 'dark':
default:
return '#333'
}
2019-05-14 23:39:16 +00:00
},
full_serial() {
return this.serial + this.dbentry.rarity[0]
},
ffiurl() {
return (
'https://fftcg.square-enix-games.com/theme/tcg/images/cards/full/' +
this.full_serial +
'_eg.jpg'
)
2019-05-14 23:13:44 +00:00
}
}
}
</script>