<script>
	import { todaysCharacterBirthdays } from '$lib/AniList/character';
	import Error from '$lib/Error.svelte';
</script>

{#await todaysCharacterBirthdays()}
	Loading ...
{:then birthdays}
	<div id="characters">
		{#each birthdays as birthday}
			<div>
				<a href={`https://anilist.co/character/${birthday.id}`} target="_blank">
					{birthday.name.full}
					<img src={birthday.image.large} alt="Character (Large)" class="character-image" />
				</a>
			</div>
		{/each}
	</div>
{:catch}
	<Error type="Character" />
{/await}

<style>
	#characters {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(8%, 1fr));
		grid-gap: 0;
		grid-row-gap: 1rem;
	}
</style>
