Skip to content

Commit 78e6320

Browse files
authored
Merge pull request #6 from CNAG-Biomedical-Informatics/codex/add-headerbar-similar-to-mkdocs
Add header bar
2 parents 1f3f3b5 + 16ecc4c commit 78e6320

2 files changed

Lines changed: 55 additions & 8 deletions

File tree

src/App.svelte

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import { onMount } from "svelte";
1414
import { Sheet, FileJson2 } from "lucide-svelte";
1515
import { CodeJar } from "@novacbn/svelte-codejar";
16+
import Header from "./Header.svelte";
1617
1718
import { createDbWorker } from "sql.js-httpvfs";
1819
@@ -235,27 +236,24 @@
235236
}
236237
</script>
237238
239+
<Header />
240+
238241
<main class="pt-8 pb-12 lg:pt-12 lg:pb-12 bg-white">
239242
<div class=" px-4 mx-auto max-w-screen-xl">
240-
<div class="p-8">
241-
<Heading tag="h2" customeSize="text-4xl font-extrabold "
242-
>Pheno-Ranker Use Cases Playground</Heading
243-
>
244-
</div>
245-
246243
{#if sqliteFiles.length}
247244
<div class="border-b mb-4">
248245
<nav class="flex space-x-4" aria-label="Tabs">
249246
{#each sqliteFiles as f}
250247
<button
251248
class={`py-2 px-4 text-sm font-medium border-b-2 ${
252-
activeFile === f.name
249+
activeTable.replace(/\_table$/, "") ===
250+
f.name.replace(/\.db$/, "")
253251
? "border-blue-600 text-blue-600"
254252
: "border-transparent text-gray-500"
255253
}`}
256254
on:click={() => loadDb(f)}
257255
>
258-
{f.name}
256+
{f.name.replace(/\.db$/, "").toUpperCase()}
259257
</button>
260258
{/each}
261259
</nav>

src/Header.svelte

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<script>
2+
import { onMount } from "svelte";
3+
import { Sun, Moon, Github } from "lucide-svelte";
4+
let dark = false;
5+
6+
onMount(() => {
7+
dark =
8+
document.documentElement.classList.contains("dark") ||
9+
window.matchMedia("(prefers-color-scheme: dark)").matches;
10+
if (dark) document.documentElement.classList.add("dark");
11+
});
12+
13+
function toggleTheme() {
14+
dark = !dark;
15+
document.documentElement.classList.toggle("dark", dark);
16+
}
17+
</script>
18+
19+
<header class="bg-white border-b dark:bg-gray-800">
20+
<div class="max-w-screen-xl mx-auto flex items-center justify-between p-4">
21+
<span class="flex items-center space-x-2">
22+
<img src="/pheno-ranker-favicon-2x.png" alt="logo" class="h-8 w-8" />
23+
<span class="text-lg font-semibold whitespace-nowrap"
24+
>Pheno-Ranker Use Cases Playground</span
25+
>
26+
</span>
27+
<div class="flex items-center space-x-4">
28+
<button
29+
on:click={toggleTheme}
30+
aria-label="Toggle dark mode"
31+
class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700"
32+
>
33+
{#if dark}
34+
<Sun class="w-5 h-5" />
35+
{:else}
36+
<Moon class="w-5 h-5" />
37+
{/if}
38+
</button>
39+
<a
40+
href="https://github.com/CNAG-Biomedical-Informatics/sql.js-httpvfs-playground"
41+
target="_blank"
42+
aria-label="Go to repository"
43+
class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700"
44+
>
45+
<Github class="w-5 h-5" />
46+
</a>
47+
</div>
48+
</div>
49+
</header>

0 commit comments

Comments
 (0)