2021-01-20 22:36:47 +00:00
|
|
|
<template lang="html">
|
|
|
|
<div>
|
|
|
|
<b-button
|
2021-01-25 16:50:35 +00:00
|
|
|
v-b-modal="modalId"
|
2021-01-20 22:36:47 +00:00
|
|
|
variant="warning"
|
2021-01-29 19:53:11 +00:00
|
|
|
class="mb-3"
|
2021-01-20 22:36:47 +00:00
|
|
|
v-if="amazonLinks.length"
|
|
|
|
>
|
|
|
|
<i class="fab fa-amazon fa-fw" aria-hidden />
|
|
|
|
Available on Amazon
|
|
|
|
</b-button>
|
|
|
|
|
|
|
|
<b-modal
|
2021-01-25 16:50:35 +00:00
|
|
|
:id="modalId"
|
2021-01-20 22:36:47 +00:00
|
|
|
hide-footer
|
|
|
|
>
|
|
|
|
<template v-slot:modal-header="{ close }">
|
|
|
|
<modal-header
|
|
|
|
:title="`Find ${game.name} on Amazon`"
|
|
|
|
@close="close"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<p>Support Gamebrary by using these affiliate links to purchase games from Amazon.</p>
|
|
|
|
|
|
|
|
<div class="links">
|
|
|
|
<a
|
|
|
|
v-if="link.uid && link.url"
|
|
|
|
v-for="link in amazonLinks"
|
|
|
|
:key="link.url"
|
|
|
|
:href="`https://amazon.com/dp/${link.uid}?tag=gamebrary0e-20`"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
<b-img
|
|
|
|
:src="`http://images.amazon.com/images/P/${link.uid}.01._SCMZZZZZZZ_.jpg`"
|
|
|
|
thumbnail
|
|
|
|
/>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</b-modal>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
game: Object,
|
2021-01-25 16:50:35 +00:00
|
|
|
modalId: {
|
|
|
|
type: String,
|
|
|
|
default: 'amazon',
|
|
|
|
},
|
2021-01-20 22:36:47 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
amazonLinks() {
|
|
|
|
return this.game && this.game.external_games
|
|
|
|
? this.game.external_games.filter(({ category }) => category === 20)
|
|
|
|
: [];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
|
.links {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
grid-gap: 1rem;
|
|
|
|
}
|
|
|
|
</style>
|