aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools/CharacterBirthdays.svelte
blob: d1d03ed04a4cb483f0232ca77e2c8b653da72180 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<script>
	import { ACDBBirthdays } from '$lib/ACDB';
	import Error from '$lib/Error.svelte';

	let date = new Date();
</script>

{#await ACDBBirthdays(date.getMonth() + 1, date.getDate())}
	<p>Loading ...</p>
{:then birthdays}
	<p>
		This tool does not use AniList's API, so it will have more characters than AniList, but also
		some unexpected characters which may not be present in AniList.
	</p>

	<div id="characters">
		{#each birthdays as birthday}
			<div>
				<a
					href={`https://anilist.co/search/characters?search=${encodeURIComponent(
						birthday.name
					).replace(/%20/g, '+')}`}
					target="_blank"
				>
					{birthday.name}
					<img src={birthday.character_image} 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.25%;
		grid-row-gap: 1rem;
	}
</style>