add item display

This commit is contained in:
Branden J Brown 2024-01-30 20:56:23 -06:00
parent f3971a4b28
commit a170a5884a
3 changed files with 40 additions and 4 deletions

View File

@ -13,6 +13,7 @@ declare module 'vue' {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
Player: typeof import('./src/components/Player.vue')['default']
PlayerHP: typeof import('./src/components/PlayerHP.vue')['default']
PlayerItems: typeof import('./src/components/PlayerItems.vue')['default']
TheLanding: typeof import('./src/components/TheLanding.vue')['default']
}
}

View File

@ -1,8 +1,14 @@
<template>
<v-container class="fill-height">
<v-row :class="rowClass">
<v-container>
<v-row :class="closeClass">
<PlayerHP :hp="props.stats.hp" />
</v-row>
<v-row>
<v-col cols="4"></v-col>
<v-col cols="8">
<PlayerItems :items="props.stats.items" />
</v-col>
</v-row>
</v-container>
</template>
@ -17,5 +23,6 @@ export interface Props {
const props = defineProps<Props>();
const rowClass = computed(() => ({ 'd-flex': true, 'justify-end': props.dealer, 'justify-start': !props.dealer }));
</script>
const closeClass = computed(() => ({ 'd-flex': true, 'justify-end': props.dealer, 'justify-start': !props.dealer }));
const farClass = computed(() => ({ 'd-flex': true, 'justify-end': !props.dealer, 'justify-start': props.dealer }));
</script>

View File

@ -0,0 +1,28 @@
<template>
<v-container>
<v-row v-for="r in 4">
<v-col v-for="c in 2" cols="4">
<v-btn :disabled="!props.items[itemIndex(r, c)]" @click="emit('item', itemIndex(r, c))">
{{ props.items[itemIndex(r, c)] }}
</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<script setup lang="ts">
export interface Props {
items: string[];
}
export interface Emits {
(e: 'item', k: number): void;
}
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
function itemIndex(r: number, c: number): number {
return (r - 1) * 2 + (c - 1);
}
</script>