about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/Navbar.svelte14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Navbar.svelte b/src/Navbar.svelte
index 97d8348..5b70e53 100644
--- a/src/Navbar.svelte
+++ b/src/Navbar.svelte
@@ -7,19 +7,21 @@
 
   const dispatch = createEventDispatcher();
 
-  const pageHome = () => {dispatch('message', { page: Home });}
-  const pageDDA = () => {dispatch('message', { page: DDA });}
-  const pageBresenham = () => {dispatch('message', { page: Bresenham });}
+  const changePage = (p) => dispatch('message', { page: p });
 </script>
 
 <nav class="ddmenu">
-  <button on:click={pageHome}>Home</button>
+  <button on:click={() => changePage(Home)}>Home</button>
 
   <div class="ddgroup">
     Line Drawing Algorithms
     <div class="ddsub">
-      <button on:click={pageDDA}>Digital differential analyzer</button>
-      <button on:click={pageBresenham}>Bresenham</button>
+      <button on:click={() => changePage(DDA)}>
+        Digital differential analyzer
+      </button>
+      <button on:click={() => changePage(Bresenham)}>
+        Bresenham
+      </button>
     </div>
   </div>
 </nav>