<script setup>
import Avatar from "@/components/Avatar.vue";
defineProps({
  isMelee: {
    type: Boolean,
    default: false,
  },
  blueTeam: {
    type: Array,
    default: () => [],
  },
  redTeam: {
    type: Array,
    default: () => [],
  },
});
</script>

<template>
  <view class="container">
    <image
      :src="`../static/battle-header${isMelee ? '-melee' : ''}.png`"
      mode="widthFix"
    />
    <view v-if="isMelee" class="players-melee">
      <view></view>
    </view>
    <view v-if="!isMelee" class="players">
      <view>
        <Avatar v-if="blueTeam[0]" :src="blueTeam[0].avatar" frame />
        <text>{{ blueTeam[0].name }}</text>
      </view>
      <view>
        <Avatar v-if="redTeam[0]" :src="redTeam[0].avatar" frame />
        <text>{{ redTeam[0].name }}</text>
      </view>
    </view>
  </view>
</template>

<style scoped>
.container {
  width: 100%;
  position: relative;
  margin-bottom: 10px;
}
.container > image:first-child {
  position: absolute;
  width: 100%;
  top: -10px;
}
.players {
  display: flex;
}
.players > view {
  width: 50%;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff9;
  font-size: 14px;
  padding-top: 20px;
  overflow: hidden;
}
.players > view:first-child {
  background-color: #364469;
}
.players > view:last-child {
  background-color: #692735;
}
</style>
