jevstrudel.git / website / src / pages / examples / index.astro
index.astro30 lines · 970 B · raw
1---
2import * as tunes from '../../../src/repl/tunes.mjs';
3import HeadCommon from '../../components/HeadCommon.astro';
4
5import { getMetadata } from '../../metadata_parser';
6
7const { BASE_URL } = import.meta.env;
8const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
9---
10
11<head>
12  <HeadCommon />
13</head>
14<body class="bg-slate-800">
15  <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-2 p-2 select-none">
16    {
17      Object.entries(tunes).map(([name, tune]) => (
18        <a
19          class="rounded-md bg-slate-900 hover:bg-slate-700 cursor-pointer relative block w-full h-[160px]"
20          href={`${baseNoTrailing}/#${btoa(tune)}`}
21        >
22          <div class="absolute w-full h-full flex justify-center items-center">
23            <span class="bg-slate-800 p-2 rounded-md text-white">{getMetadata(tune)['title'] || name}</span>
24          </div>
25        </a>
26      ))
27    }
28  </div>
29</body>
30../../metadata_parser