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>
|
|
|
|
|
2021-04-01 22:15:11 +00:00
|
|
|
<b-alert show variant="success">
|
|
|
|
Support Gamebrary by using these affiliate links to purchase games from Amazon.
|
|
|
|
</b-alert>
|
2021-01-20 22:36:47 +00:00
|
|
|
|
2021-04-01 22:15:11 +00:00
|
|
|
<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"
|
|
|
|
class="mr-2 mb-2"
|
|
|
|
>
|
|
|
|
<b-img
|
|
|
|
:src="`http://images.amazon.com/images/P/${link.uid}.01._SCMZZZZZZZ_.jpg`"
|
|
|
|
thumbnail
|
|
|
|
/>
|
|
|
|
</a>
|
2021-01-20 22:36:47 +00:00
|
|
|
</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>
|