<script lang="ts">
	import type { HoverCoverResponse } from './hoverCover';

	export let options: HoverCoverResponse;
	export let width = 250;
</script>

{#if options.hovering}
	<img
		class="hover-image show card card-small"
		src={options.media
			? options.media.coverImage.extraLarge
			: `https://subsplease.org${options.item?.image_url}`}
		alt="Media Cover"
		style={`width: ${width}px; ${options.style}`}
	/>
{/if}

<style>
	.hover-image {
		position: fixed;
		z-index: 1000;
		height: auto;
		display: none;
		border-radius: 8px;
	}

	.show {
		display: block;
	}
</style>
