src/pages/birds.astro 1.8 K raw
1
---
2
import PageLayout from "@/layouts/Base.astro";
3
import { birds } from "@/data/birds";
4
5
const meta = {
6
	title: "/birds",
7
	description: "My life list — every species I've logged on Merlin Bird ID",
8
};
9
---
10
11
<PageLayout meta={meta}>
12
	<div class="flex min-h-screen flex-col items-start justify-start gap-6">
13
		<div>
14
      <h1 class="title">/birds</h1>
15
			<p class="mt-2 text-sm text-zinc-400">{birds.length} species observed</p>
16
		</div>
17
		<div class="flex w-full flex-col sm:grid sm:grid-cols-2">
18
			{birds.map((bird) => (
19
				<a
20
					href={`https://www.allaboutbirds.org/guide/${bird.commonName.replace(/ /g, "_")}`}
21
					target="_blank"
22
					rel="noopener noreferrer"
23
					class="flex items-center gap-4 border-b border-[#333] py-3 no-underline transition-opacity hover:opacity-70"
24
				>
25
					{bird.photo ? (
26
						<img
27
							src={bird.photo}
28
							alt={bird.commonName}
29
							class="h-16 w-16 flex-shrink-0 rounded object-cover"
30
							loading="lazy"
31
						/>
32
					) : (
33
						<div class="flex h-16 w-16 flex-shrink-0 items-center justify-center rounded bg-[#1a1a1a]">
34
							<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 opacity-30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
35
								<path d="M16 7h.01M3.055 11H5a2 2 0 0 1 2 2v1a2 2 0 0 0 2 2a2 2 0 0 1 2 2v2.945M8 3.935V5.5A2.5 2.5 0 0 0 10.5 8h.5a2 2 0 0 1 2 2a2 2 0 0 0 4 0a2 2 0 0 1 2-2h1.064M15 20.488V18a2 2 0 0 1 2-2h3.064M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0"/>
36
							</svg>
37
						</div>
38
					)}
39
					<div class="flex flex-col gap-0.5">
40
						<span class="text-base">{bird.commonName}</span>
41
						<span class="text-xs italic opacity-50">{bird.scientificName}</span>
42
						{bird.summary && (
43
							<span class="mt-0.5 text-xs opacity-50 line-clamp-2">{bird.summary}</span>
44
						)}
45
					</div>
46
				</a>
47
			))}
48
		</div>
49
	</div>
50
</PageLayout>