Card Component
This commit is contained in:
parent
e372ed1b7c
commit
126f800111
3 changed files with 67 additions and 15 deletions
52
frontend/src/components/Card.vue
Normal file
52
frontend/src/components/Card.vue
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<template>
|
||||||
|
<v-list-tile avatar>
|
||||||
|
<v-list-tile-avatar :color="color">
|
||||||
|
<span class="headline font-weight-bold white--text">{{ dbentry.cost }}</span>
|
||||||
|
</v-list-tile-avatar>
|
||||||
|
|
||||||
|
<v-list-tile-content>
|
||||||
|
<v-list-tile-title class="body-2">{{ dbentry.name }}</v-list-tile-title>
|
||||||
|
<v-list-tile-sub-title>{{ serial }}</v-list-tile-sub-title>
|
||||||
|
</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
|
||||||
|
},
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -10,23 +10,17 @@
|
||||||
|
|
||||||
<v-container grid-list-md fluid>
|
<v-container grid-list-md fluid>
|
||||||
<v-layout row wrap>
|
<v-layout row wrap>
|
||||||
<v-flex v-for="part in deck_parts" :key="part.heading" xs12 sm4>
|
<v-flex v-for="part in deck_parts" :key="part.heading" xs12 sm6 md4>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>{{ part.count }} {{ part.heading }}</v-card-title>
|
<v-card-title>{{ part.count }} {{ part.heading }}</v-card-title>
|
||||||
<v-list dense subheader>
|
<v-list dense subheader>
|
||||||
<v-list-tile v-for="card in part.cards" :key="card.serial" avatar>
|
<Card
|
||||||
<v-list-tile-avatar color="yellow">
|
v-for="card in part.cards"
|
||||||
<span>{{ card.dbentry.cost }}</span>
|
:key="card.serial"
|
||||||
</v-list-tile-avatar>
|
:count="card.count"
|
||||||
|
:serial="card.serial"
|
||||||
<v-list-tile-content>
|
:dbentry="card.dbentry"
|
||||||
<v-list-tile-title>{{ card.dbentry.name }}</v-list-tile-title>
|
></Card>
|
||||||
</v-list-tile-content>
|
|
||||||
|
|
||||||
<v-list-tile-avatar>
|
|
||||||
<span>{{ card.count }}</span>
|
|
||||||
</v-list-tile-avatar>
|
|
||||||
</v-list-tile>
|
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
|
@ -36,6 +30,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Card from './Card.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Deck',
|
name: 'Deck',
|
||||||
|
|
||||||
|
@ -43,6 +39,10 @@ export default {
|
||||||
deck: Object
|
deck: Object
|
||||||
},
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Card
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
deck_parts() {
|
deck_parts() {
|
||||||
let retval = {
|
let retval = {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<script>
|
<script>
|
||||||
import CardsDB from '@/plugins/ffdecks'
|
import CardsDB from '@/plugins/ffdecks'
|
||||||
|
|
||||||
import Deck from '@/components/Deck.vue'
|
import Deck from './Deck.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeckList',
|
name: 'DeckList',
|
||||||
|
|
Reference in a new issue