Make normal links in header more generic

This commit is contained in:
Tobias Berger 2021-10-05 12:54:19 +02:00
parent 6ddb78ef50
commit 9b9992a015

View file

@ -35,10 +35,7 @@
donate() {
console.log("donate");
},
discord() {
// No-Op
throw new Error("This function shouldn't have been called.");
},
discord: discordLink,
notice() {
console.log("notice");
},
@ -52,17 +49,23 @@
<header id="header">
<ul id="main-header-buttons">
{#each Object.entries(mainHeaderButtons) as [name, onClick]}
<li><a on:click={onClick} href={"javascript:;"}>{name}</a></li>
<li>
{#if typeof onClick === "function"}
<a on:click={onClick} href={"javascript:;"}>{name}</a>
{:else if typeof onClick === "string"}
<a target="_blank" rel="noreferrer noopener" href={onClick}>{name}</a>
{/if}
</li>
{/each}
</ul>
<span>{title}</span>
<ul id="other-header-buttons">
{#each Object.entries(otherHeaderButtons) as [name, onClick]}
<li>
{#if name === "discord"}
<a href={discordLink} rel="noopener" target="_blank">{name}</a>
{:else}
{#if typeof onClick === "function"}
<a on:click={onClick} href={"javascript:;"}>{name}</a>
{:else if typeof onClick === "string"}
<a target="_blank" rel="noreferrer noopener" href={onClick}>{name}</a>
{/if}
</li>
{/each}