2020-08-22 18:59:58 +00:00
|
|
|
<template lang="html">
|
|
|
|
<div class="platform-picker">
|
|
|
|
<b-form-group label="Select platform(s)" class="mb-1" />
|
|
|
|
|
2020-08-25 04:21:24 +00:00
|
|
|
<platform-picker-sort-filter />
|
|
|
|
|
2020-09-01 23:28:34 +00:00
|
|
|
<b-form-row>
|
2020-08-26 17:34:59 +00:00
|
|
|
<b-col
|
|
|
|
cols="6"
|
|
|
|
md="4"
|
|
|
|
lg="3"
|
|
|
|
v-for="platform in filteredPlatforms"
|
|
|
|
:key="platform.id"
|
2020-09-01 23:28:34 +00:00
|
|
|
class="mb-3 d-flex"
|
2020-08-26 17:34:59 +00:00
|
|
|
>
|
2020-08-26 16:29:44 +00:00
|
|
|
<b-card
|
|
|
|
:header="platform.name"
|
|
|
|
:header-class="['py-0 px-2', value.includes(platform.id) ? 'text-white' : '']"
|
|
|
|
:border-variant="value.includes(platform.id) ? 'success' : ''"
|
|
|
|
:header-bg-variant="value.includes(platform.id) ? 'success' : ''"
|
2020-09-01 23:28:34 +00:00
|
|
|
:body-bg-variant="value.includes(platform.id) ? 'success' : 'white'"
|
|
|
|
body-class="p-2 d-flex align-items-center justify-content-center platform"
|
2020-08-26 16:29:44 +00:00
|
|
|
header-tag="small"
|
2020-09-01 23:28:34 +00:00
|
|
|
class="w-100"
|
2020-08-26 16:29:44 +00:00
|
|
|
@click="handleClick(platform.id)"
|
|
|
|
>
|
|
|
|
<b-img
|
2020-08-26 18:06:47 +00:00
|
|
|
:src="`/static/platform-logos/${platform.slug}.${platform.logoFormat}`"
|
2020-08-26 16:29:44 +00:00
|
|
|
:alt="platform.name"
|
2020-09-01 23:28:34 +00:00
|
|
|
:class="['platform-logo p-2', { selected: value.includes(platform.id) }]"
|
2020-08-26 16:29:44 +00:00
|
|
|
/>
|
|
|
|
</b-card>
|
|
|
|
</b-col>
|
2020-09-01 23:28:34 +00:00
|
|
|
</b-form-row>
|
2020-08-22 18:59:58 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-08-25 04:21:24 +00:00
|
|
|
import PlatformPickerSortFilter from '@/components/Board/PlatformPickerSortFilter';
|
|
|
|
import { mapGetters } from 'vuex';
|
2020-08-22 18:59:58 +00:00
|
|
|
|
|
|
|
export default {
|
2020-08-25 04:21:24 +00:00
|
|
|
components: {
|
|
|
|
PlatformPickerSortFilter,
|
|
|
|
},
|
|
|
|
|
2020-08-22 18:59:58 +00:00
|
|
|
props: {
|
|
|
|
value: Array,
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-08-25 04:21:24 +00:00
|
|
|
...mapGetters(['filteredPlatforms']),
|
2020-08-22 18:59:58 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
handleClick(platformId) {
|
|
|
|
if (this.value.includes(platformId)) {
|
|
|
|
this.removePlatform(platformId);
|
|
|
|
} else {
|
|
|
|
this.selectPlatform(platformId);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
selectPlatform(platformId) {
|
|
|
|
this.value.push(platformId);
|
|
|
|
},
|
|
|
|
|
|
|
|
removePlatform(platformId) {
|
|
|
|
const index = this.value.indexOf(platformId);
|
|
|
|
|
|
|
|
this.value.splice(index, 1);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
2020-08-26 16:29:44 +00:00
|
|
|
.platform {
|
|
|
|
height: 80px;
|
2020-08-22 18:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.platform-logo {
|
2020-08-26 16:29:44 +00:00
|
|
|
max-height: 60px;
|
|
|
|
width: auto;
|
|
|
|
max-width: 100%;
|
2020-09-01 23:28:34 +00:00
|
|
|
|
|
|
|
&.selected {
|
|
|
|
filter:
|
|
|
|
drop-shadow(0 1px 0 white)
|
|
|
|
drop-shadow(0 -1px 0 white)
|
|
|
|
drop-shadow(1px 0 0 white)
|
|
|
|
drop-shadow(-1px 0 0 white);
|
|
|
|
}
|
2020-08-22 18:59:58 +00:00
|
|
|
}
|
|
|
|
</style>
|