<template>
	<router-link :to="toUrl(link)">
		<img :alt="`${title} - ${author}`"
			:src="imageUrl"
			:title="author">
	</router-link>
</template>

<script>
export default {
	name: 'TopItem',
	components: {},
	props: {
		author: {
			type: String,
			required: true,
		},
		imageUrl: {
			type: String,
			required: true,
		},
		link: {
			type: String,
			required: true,
		},
		title: {
			type: String,
			required: true,
		},
	},
	methods: {
		toUrl(url) {
			return `/${btoa(url)}`
		},
	},
}
</script>

<style scoped>
	img {
		height: 100%;
		width: 100%;
	}
</style>
