summaryrefslogtreecommitdiff
path: root/src/components/ScotsounCdGallery.astro
blob: 1c810a0e0178e20684dd31391d9db85925e291df (plain)
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
---
import { getAllScotsoun } from '$data/scotsoun';
import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
import type Scotsoun from '$types/Scotsoun';

const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const scotsoun = (await getAllScotsoun()).sort(scotsounIdDescending);

function scotsounIdDescending(scotsoun1: Scotsoun, scotsoun2: Scotsoun) {
  return scotsoun2.scotsounId.localeCompare(scotsoun1.scotsounId);
}
---

<ul class="link-gallery">
  {
    scotsoun.map((scotsounItem) => (
      <li>
        <a
          class="link link-gallery__container"
          href={`/${locale}/furthsettins/scotsoun/${scotsounItem.scotsounId}`}
        >
          <img src={scotsounItem.img.src} alt="" />
          <p class="link-gallery__title">{scotsounItem.title}</p>
        </a>
      </li>
    ))
  }
</ul>