2019-04-08 20:06:22 +00:00
|
|
|
<template>
|
2019-04-10 20:05:52 +00:00
|
|
|
<form @submit.prevent="formSubmit" class="flex text-teal-100 text-lg w-full">
|
|
|
|
|
<div class="relative w-full">
|
|
|
|
|
<!-- <v-icon name="search" class="absolute ml-2 vertical-center"></v-icon> -->
|
2019-04-16 13:34:38 +00:00
|
|
|
<input
|
|
|
|
|
type="text"
|
2019-04-10 20:05:52 +00:00
|
|
|
autofocus
|
2019-04-16 13:34:38 +00:00
|
|
|
class="input w-full px-2 py-4 rounded-lg outline-none pl-8 pr-16 font-bold"
|
2019-04-08 20:06:22 +00:00
|
|
|
v-model="summoner"
|
|
|
|
|
>
|
2019-04-10 20:05:52 +00:00
|
|
|
<div class="absolute right-0 vertical-center flex items-center h-full mr-2">
|
2019-04-16 13:34:38 +00:00
|
|
|
<div
|
|
|
|
|
v-bind:class="{'bg-teal-600' : dropdown}"
|
2019-04-08 20:06:22 +00:00
|
|
|
@click="dropdown = !dropdown"
|
2019-04-16 13:34:38 +00:00
|
|
|
class="cursor-pointer flex items-center px-2 py-1 rounded"
|
2019-04-08 20:06:22 +00:00
|
|
|
>
|
2019-04-10 20:05:52 +00:00
|
|
|
<span class="selected font-bold">{{ selectedRegion }}</span>
|
2019-04-08 20:06:22 +00:00
|
|
|
<v-icon name="caret-down" class="ml-1"></v-icon>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-04-16 12:28:42 +00:00
|
|
|
<transition
|
|
|
|
|
enter-active-class="transition-all transition-fastest ease-out-quad"
|
|
|
|
|
leave-active-class="transition-all transition-faster ease-in-quad"
|
|
|
|
|
enter-class="opacity-0 scale-70"
|
|
|
|
|
enter-to-class="opacity-100 scale-100"
|
|
|
|
|
leave-class="opacity-100 scale-100"
|
|
|
|
|
leave-to-class="opacity-0 scale-70"
|
|
|
|
|
>
|
2019-04-10 20:05:52 +00:00
|
|
|
<div
|
|
|
|
|
v-if="dropdown"
|
|
|
|
|
@click="dropdown = !dropdown"
|
2019-04-16 13:34:38 +00:00
|
|
|
class="absolute right-0 text-white rounded-b shadow cursor-pointer mr-2 offsetDropDown"
|
2019-04-08 20:06:22 +00:00
|
|
|
>
|
2019-04-16 13:34:38 +00:00
|
|
|
<div
|
|
|
|
|
v-for="(region, index) in regions"
|
2019-04-10 20:05:52 +00:00
|
|
|
:key="region"
|
|
|
|
|
@click="selectedRegion = region"
|
2019-04-16 13:34:38 +00:00
|
|
|
class="px-4b py-1 text-xs bg-teal-600 hover:bg-teal-500"
|
2019-04-10 20:05:52 +00:00
|
|
|
:class="classRegions(index)"
|
2019-04-16 13:34:38 +00:00
|
|
|
>{{ region }}</div>
|
2019-04-08 20:06:22 +00:00
|
|
|
</div>
|
2019-04-10 20:05:52 +00:00
|
|
|
</transition>
|
2019-04-08 20:06:22 +00:00
|
|
|
</div>
|
|
|
|
|
|
2019-04-10 20:05:52 +00:00
|
|
|
<button class="input btn w-20 rounded-lg ml-2 relative" type="submit">
|
|
|
|
|
<v-icon name="search" class="absolute vertical-center horizontal-center"></v-icon>
|
|
|
|
|
</button>
|
2019-04-08 20:06:22 +00:00
|
|
|
</form>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
data: Object
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2019-04-16 13:34:38 +00:00
|
|
|
summoner: "",
|
2019-04-08 20:06:22 +00:00
|
|
|
dropdown: false,
|
2019-04-16 13:34:38 +00:00
|
|
|
regions: [
|
|
|
|
|
"BR",
|
|
|
|
|
"EUNE",
|
|
|
|
|
"EUW",
|
|
|
|
|
"JP",
|
|
|
|
|
"KR",
|
|
|
|
|
"LAN",
|
|
|
|
|
"LAS",
|
|
|
|
|
"NA",
|
|
|
|
|
"OCE",
|
|
|
|
|
"TR",
|
|
|
|
|
"RU"
|
|
|
|
|
],
|
|
|
|
|
selectedRegion: "EUW"
|
2019-04-08 20:06:22 +00:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
classRegions(index) {
|
|
|
|
|
return {
|
2019-04-16 13:34:38 +00:00
|
|
|
"rounded-t": index === 0,
|
|
|
|
|
"rounded-b": index === this.regions.length - 1
|
|
|
|
|
};
|
2019-04-08 20:06:22 +00:00
|
|
|
},
|
|
|
|
|
formSubmit() {
|
2019-04-16 13:34:38 +00:00
|
|
|
console.log("form submit child");
|
|
|
|
|
this.$emit(
|
|
|
|
|
"formSubmit",
|
|
|
|
|
this.summoner,
|
|
|
|
|
this.selectedRegion.toLowerCase()
|
|
|
|
|
);
|
2019-04-08 20:06:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-16 13:34:38 +00:00
|
|
|
};
|
2019-04-08 20:06:22 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2019-04-16 13:34:38 +00:00
|
|
|
.offsetDropDown {
|
|
|
|
|
top: 57px;
|
|
|
|
|
right: 1px;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-10 20:05:52 +00:00
|
|
|
.bounce-enter-active {
|
2019-04-16 13:34:38 +00:00
|
|
|
animation: bounce-in 0.5s;
|
2019-04-10 20:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bounce-leave-active {
|
2019-04-16 13:34:38 +00:00
|
|
|
animation: bounce-in 0.5s reverse;
|
2019-04-10 20:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes bounce-in {
|
|
|
|
|
0% {
|
|
|
|
|
transform: scale(0);
|
|
|
|
|
}
|
|
|
|
|
50% {
|
|
|
|
|
transform: scale(1.25);
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
}
|
2019-04-08 20:06:22 +00:00
|
|
|
}
|
|
|
|
|
</style>
|