diff --git a/client/src/components/SVGContainer.vue b/client/src/components/SVGContainer.vue index 25ce9fe..9f8a0db 100644 --- a/client/src/components/SVGContainer.vue +++ b/client/src/components/SVGContainer.vue @@ -17,6 +17,7 @@ + diff --git a/client/src/components/SearchForm.vue b/client/src/components/SearchForm.vue index 0c124d9..e49ea74 100644 --- a/client/src/components/SearchForm.vue +++ b/client/src/components/SearchForm.vue @@ -59,14 +59,8 @@ class="absolute right-0 z-30 h-full hover:text-teal-200" type="submit" > - - + + diff --git a/client/src/components/Summoner/Champions/ChampionsSearch.vue b/client/src/components/Summoner/Champions/ChampionsSearch.vue new file mode 100644 index 0000000..f6fd0e1 --- /dev/null +++ b/client/src/components/Summoner/Champions/ChampionsSearch.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/client/src/components/Summoner/Champions/ChampionsTable.vue b/client/src/components/Summoner/Champions/ChampionsTable.vue index 9be2786..c87ff3d 100644 --- a/client/src/components/Summoner/Champions/ChampionsTable.vue +++ b/client/src/components/Summoner/Champions/ChampionsTable.vue @@ -19,12 +19,12 @@
{{ champion.index + 1 }} @@ -103,6 +103,10 @@ export default { champions: { type: Array, required: true + }, + search: { + type: String, + default: '' } }, @@ -163,6 +167,7 @@ export default { } ], championsFull: [], + championsToDisplay: [], sortProps: 'index', order: -1 } @@ -174,6 +179,14 @@ export default { } }, + watch: { + search() { + this.championsToDisplay = this.championsFull.filter(c => { + return c.champion.name.toLowerCase().includes(this.search.toLowerCase()) + }) + } + }, + mounted() { this.championsFull = this.champions.map((champ, index) => { return { @@ -182,15 +195,18 @@ export default { playrate: champ.count * 100 / this.totalGames, kda: (champ.kills + champ.assists) / champ.deaths, index, - lastPlayed: timeDifference(champ.date) + lastPlayed: timeDifference(champ.date), + show: true } }) + + this.championsToDisplay = this.championsFull }, methods: { bgColor(champion, rgb, stats) { const value = parseFloat(champion[stats]) - const biggestValue = Math.max(...this.championsFull.map(c => parseFloat(c[stats])), 0) + const biggestValue = Math.max(...this.championsToDisplay.map(c => parseFloat(c[stats])), 0) const opacity = (value / biggestValue).toFixed(2) return { @@ -205,7 +221,7 @@ export default { this.order = -1 } - this.championsFull.sort((a, b) => { + this.championsToDisplay.sort((a, b) => { const aProp = props.split('.').reduce((p, c) => p && p[c] || null, a) const bProp = props.split('.').reduce((p, c) => p && p[c] || null, b) let order = aProp > bProp ? this.order : this.order * -1 diff --git a/client/src/views/SummonerChampions.vue b/client/src/views/SummonerChampions.vue index 2ceccd3..f0dadb2 100644 --- a/client/src/views/SummonerChampions.vue +++ b/client/src/views/SummonerChampions.vue @@ -1,10 +1,12 @@
+
@@ -12,13 +14,21 @@