LeagueStats/client/src/components/Match.vue

260 lines
8.4 KiB
Vue
Raw Normal View History

2019-03-30 22:55:48 +00:00
<template>
<li class="relative">
<div class="game-status absolute left-0 h-32 w-32">
<div class="text-2xl text-teal-500 uppercase font-extrabold">{{ data.status }}</div>
</div>
<div
:class="matchResultClass"
2019-10-12 14:34:05 +00:00
class="ml-10 match relative mt-4 rounded-lg text-white text-base"
>
<div class="relative z-20 flex flex-wrap px-5 py-3">
<div class="first w-1/3 text-left">
<div>
<div
class="h-6 text-lg text-teal-500 font-extrabold uppercase leading-none"
>{{ data.champion.name }}</div>
<div class="flex">
2019-09-19 17:26:44 +00:00
<div class="flex flex-col justify-end items-center">
<div
2019-09-19 17:26:44 +00:00
v-if="data.role !== 'NONE'"
:style="{backgroundImage: `url(${require('@/assets/img/roles/' + data.role + '.png')})`}"
class="w-10 h-10 bg-center bg-cover"
></div>
<div
class="w-10 text-center text-xs text-teal-500 font-extrabold"
>LVL {{ data.level }}</div>
</div>
<div
:style="{backgroundImage: `url('https://ddragon.leagueoflegends.com/cdn/${$patch}/img/champion/${data.champion.id}.png')`}"
2019-10-12 14:34:05 +00:00
class="ml-2 w-16 h-16 crop-champion bg-blue-1000 rounded-lg"
></div>
2019-10-12 14:34:05 +00:00
<div class="ml-2 flex flex-col justify-around">
<div
2019-09-19 17:26:44 +00:00
:style="{backgroundImage: `url(${data.firstSum})`}"
class="w-6 h-6 bg-blue-1000 rounded-md bg-center bg-cover"
></div>
<div
2019-09-19 17:26:44 +00:00
:style="{backgroundImage: `url(${data.secondSum})`}"
class="w-6 h-6 bg-blue-1000 rounded-md bg-center bg-cover"
></div>
</div>
2019-10-12 14:34:05 +00:00
<div class="ml-1 flex flex-col justify-around">
<div
:style="[data.primaryRune ? {background: `url(${data.primaryRune}) center/cover`} : '']"
class="w-6 h-6 bg-blue-1000 rounded-md"
></div>
<div
:style="[data.secondaryRune ? {background: `url(${data.secondaryRune}) center/cover`} : '']"
class="w-6 h-6 bg-blue-1000 rounded-md"
></div>
</div>
2019-09-19 17:58:29 +00:00
<div class="ml-12 flex flex-col justify-center items-center leading-none">
<div class="text-3xl font-extrabold text-teal-500">
<span class>{{ data.kills }}</span>
<span class>/</span>
<span class>{{ data.deaths }}</span>
<span class>/</span>
<span class>{{ data.assists }}</span>
</div>
2019-09-19 17:58:29 +00:00
<div class="mt-2 text-white text-sm font-extrabold">{{ data.kda }} KDA</div>
</div>
2019-08-23 14:48:16 +00:00
</div>
2019-03-30 22:55:48 +00:00
<div
class="h-6 flex items-end text-sm text-white font-extrabold leading-none"
>{{ data.gamemode }}</div>
</div>
2019-08-23 14:48:16 +00:00
</div>
2019-03-30 22:55:48 +00:00
<div class="second w-1/3 py-6 flex items-center">
<div class="items flex flex-wrap">
<div
v-for="(item, index) in data.items"
:key="index"
2019-09-19 17:26:44 +00:00
:style="{backgroundImage: item}"
class="ml-1 w-8 h-8 rounded-md bg-blue-1000 bg-center bg-cover"
></div>
</div>
2019-03-30 22:55:48 +00:00
<div class="ml-12 leading-none">
<div class="flex items-center">
<img src="@/assets/img/icons/Creep.svg" alt="Minions" />
<div class="ml-1 text-teal-300 text-lg font-bold">
{{ data.minions }}
<span class="font-normal">cs</span>
</div>
</div>
<div class="flex items-center">
<img src="@/assets/img/icons/Gold.svg" alt="Gold" />
<div class="ml-1 gold text-lg font-bold">
{{ data.gold }}
<span class="font-normal">gold</span>
</div>
2019-08-23 14:48:16 +00:00
</div>
<div class="flex items-center">
<img src="@/assets/img/icons/Damage.svg" alt="Damage" />
<div class="ml-1 damage text-lg font-bold">
{{ data.damage }}
<span class="font-normal">damage</span>
</div>
</div>
<div class="flex items-center">
<img src="@/assets/img/icons/KillParticipation.svg" alt="KillParticipation" />
<div class="ml-1 kp text-lg font-bold">
{{ data.kp }}
<span class="font-normal">kp</span>
</div>
</div>
</div>
</div>
<div class="third w-1/3 py-1 flex items-center">
<div v-if="data.allyTeam.length > 1">
<div
v-for="(ally, index) in data.allyTeam"
:key="'player-' + index"
class="flex items-center leading-none"
>
<router-link
:to="{ name: 'summoner', params: { region: $route.params.region, name: ally.name }}"
2019-09-22 15:39:29 +00:00
:class="isSummonerProfile(ally.name)"
class="w-20 text-right overflow-hidden text-overflow whitespace-no-wrap text-sm text-blue-200 font-medium hover:text-blue-100"
>{{ ally.name }}</router-link>
<div
:class="index !== 0 ? '-mt-1': ''"
:style="{backgroundImage: `url('https://ddragon.leagueoflegends.com/cdn/${$patch}/img/champion/${ally.champion.id}.png')`}"
class="ml-1 w-6 h-6 bg-blue-1000 bg-center bg-cover rounded-full overflow-hidden"
></div>
<div
class="mx-3 w-4 h-4 bg-center bg-cover"
:style="{backgroundImage: `url(${require('@/assets/img/roles/' + roles[index] + '.png')})`}"
></div>
<div
:class="index !== 0 ? '-mt-1' : ''"
:style="{backgroundImage: `url('https://ddragon.leagueoflegends.com/cdn/${$patch}/img/champion/${data.enemyTeam[index].champion.id}.png')`}"
class="w-6 h-6 bg-blue-1000 bg-center bg-cover rounded-full"
></div>
<router-link
:to="{ name: 'summoner', params: { region: $route.params.region, name: data.enemyTeam[index].name }}"
class="ml-1 w-20 text-left overflow-hidden text-overflow whitespace-no-wrap text-sm text-blue-200 font-medium hover:text-blue-100"
>{{ data.enemyTeam[index].name }}</router-link>
</div>
</div>
<div class="ml-auto flex flex-col items-center justify-center">
<img class="w-5 h-5" src="@/assets/img/icons/Stopwatch.svg" alt="Stopwatch" />
<div class="text-lg text-teal-400 font-medium">{{ data.time }}</div>
<div class="text-xs text-white font-medium">{{ data.date }}</div>
2019-08-23 14:48:16 +00:00
</div>
2019-03-30 22:55:48 +00:00
</div>
</div>
</div>
2019-03-30 22:55:48 +00:00
</li>
</template>
<script>
import { mapState } from 'vuex'
2019-03-30 22:55:48 +00:00
export default {
props: {
2019-08-23 14:48:16 +00:00
data: {
type: Object,
required: true
},
},
computed: {
matchResultClass() {
return {
'win': this.data.result === 'Win',
'loss': this.data.result === 'Fail',
'remake': this.data.result === 'Remake',
}
},
...mapState({
roles: state => state.roles
}),
2019-09-22 15:39:29 +00:00
},
methods: {
isSummonerProfile(allyName) {
return {
'font-bold': this.$route.params.name.toLowerCase() === allyName.toLowerCase()
}
}
2019-03-30 22:55:48 +00:00
}
}
</script>
<style scoped>
.match {
background-image: linear-gradient(
90deg,
#2c5282 0%,
rgba(44, 82, 130, 0) 100%
);
}
.match::after {
content: "";
position: absolute;
z-index: 10;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 0.5rem;
}
.loss::after {
background-image: linear-gradient(
90deg,
rgba(140, 0, 0, 0.3) 0%,
rgba(44, 82, 130, 0) 45%
);
2019-03-30 22:55:48 +00:00
}
.remake::after {
background-image: linear-gradient(
90deg,
rgba(233, 169, 75, 0.3) 0%,
rgba(44, 82, 130, 0) 45%
);
2019-03-30 22:55:48 +00:00
}
.win::after {
background-image: linear-gradient(
90deg,
rgba(1, 97, 28, 0.3) 0%,
rgba(44, 82, 130, 0) 45%
);
}
.game-status {
top: 50%;
transform: translateY(-50%) rotate(-90deg);
2019-03-30 22:55:48 +00:00
}
.crop-champion {
background-size: 74px;
background-position: center;
2019-03-30 22:55:48 +00:00
}
.items {
width: 7rem;
height: 4.5rem;
2019-03-30 22:55:48 +00:00
}
.gold {
color: #f3a05a;
2019-03-30 22:55:48 +00:00
}
.damage {
color: #e25656;
2019-03-30 22:55:48 +00:00
}
.kp {
color: #b78787;
2019-03-30 22:55:48 +00:00
}
</style>