-
-
Notifications
You must be signed in to change notification settings - Fork 229
/
Copy pathCountriesIndexPage.tsx
46 lines (43 loc) · 1.61 KB
/
CountriesIndexPage.tsx
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
43
44
45
46
import { Head } from "./Head.js"
import { SiteHeader } from "./SiteHeader.js"
import { SiteFooter } from "./SiteFooter.js"
import { Country, sortBy } from "@ourworldindata/utils"
import { Html } from "./Html.js"
export const CountriesIndexPage = (props: {
countries: Country[]
baseUrl: string
}) => {
const { countries, baseUrl } = props
const sortedCountries = sortBy(countries, (country) => country.name)
return (
<Html>
<Head
canonicalUrl={`${baseUrl}/countries`}
pageTitle="Countries"
pageDesc="Data by individual country on Our World in Data."
baseUrl={baseUrl}
/>
<body className="CountriesIndexPage">
<SiteHeader baseUrl={baseUrl} />
<main className="wrapper">
<h1>Data by country</h1>
<ul>
{sortedCountries.map((country) => (
<li key={country.code}>
<a href={`/country/${country.slug}`}>
<img
className="flag"
src={`/images/flags/${country.code}.svg`}
loading="lazy"
/>
{country.name}
</a>
</li>
))}
</ul>
</main>
<SiteFooter baseUrl={baseUrl} />
</body>
</Html>
)
}