Light mode update
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
<script>
|
||||
import { extraMenuLinks } from '../lib/menu';
|
||||
import { theme, toggleTheme } from '../lib/theme';
|
||||
|
||||
let open = false;
|
||||
|
||||
const baseLinks = [
|
||||
$: themeLink = $theme === 'dark'
|
||||
? { label: '☀️ Light Mode', action: toggleTheme, keepOpen: true, title: 'Switch to the light theme' }
|
||||
: { label: '🌙 Dark Mode', action: toggleTheme, keepOpen: true, title: 'Switch to the dark theme' };
|
||||
|
||||
$: baseLinks = [
|
||||
{ label: '📖 Rules', href: '/rules', external: true, title: 'Open the rulebook in a new tab' },
|
||||
themeLink,
|
||||
];
|
||||
|
||||
$: links = [...$extraMenuLinks, ...baseLinks];
|
||||
@@ -29,7 +35,7 @@
|
||||
<button
|
||||
class="menu-item"
|
||||
title={link.title}
|
||||
on:click={() => { open = false; link.action(); }}
|
||||
on:click={() => { if (!link.keepOpen) open = false; link.action(); }}
|
||||
>{link.label}</button>
|
||||
{:else}
|
||||
<a
|
||||
|
||||
Reference in New Issue
Block a user