jevstrudel.git / website / src / pages / swatch / index.astro
index.astro39 lines · 1.1 KB · raw
1---
2import { getMyPatterns } from '../../my_patterns.js';
3
4import { Content } from '../../../../my-patterns/README.md';
5import HeadCommon from '../../components/HeadCommon.astro';
6
7const myPatterns = await getMyPatterns();
8
9const { BASE_URL } = import.meta.env;
10const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
11---
12
13<head>
14  <HeadCommon />
15</head>
16<body class="bg-slate-800">
17  {
18    Object.keys(myPatterns).length === 0 && (
19      <div class="prose prose-invert p-2">
20        <Content />
21      </div>
22    )
23  }
24  <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-2 p-2 select-none">
25    {
26      Object.entries(myPatterns).map(([name, tune]) => (
27        <a
28          class="rounded-md bg-slate-900 hover:bg-slate-700 cursor-pointer relative block w-full h-[160px]"
29          href={`${baseNoTrailing}/#${btoa(tune as string)}`}
30        >
31          <div class="absolute w-full h-full flex justify-center items-center">
32            <span class="bg-slate-800 p-2 rounded-md text-white">{name}</span>
33          </div>
34        </a>
35      ))
36    }
37  </div>
38</body>
39../../list.json