X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/f51f2a70794858f9c8fb5d75ecd40fd1e4ec3897..9c4975070c1d72fd10c1dec2038f840df0026b96:/src/components/PageLink.svelte

diff --git a/src/components/PageLink.svelte b/src/components/PageLink.svelte
index d70c3f0..0e2920a 100644
--- a/src/components/PageLink.svelte
+++ b/src/components/PageLink.svelte
@@ -1,12 +1,21 @@
 <script>
-import { refresh_page } from '../lib/stores.js';
+  import { refresh_page } from '../lib/stores.js';
 
-export let page;
+  export let page;
+  export let params_hash = {};
+  export let extra_classes = '';
+  let href = page + '.html';
 
-function handleClick() {
-  window.history.pushState([], '', page + '.html');
-  refresh_page();
-}
+  function handleClick() {
+    refresh_page(page, new URLSearchParams(params_hash));
+  }
+
+  $: {
+    let param_str = new URLSearchParams(params_hash).toString();
+    href = page + '.html' + (param_str ? '?' : '') + param_str;
+  }
 </script>
 
-<a on:click|preventDefault|stopPropagation={handleClick} href="{page}.html"><slot></slot></a>
+<a on:click|preventDefault|stopPropagation={handleClick} href={href} class={extra_classes}>
+  <slot></slot>
+</a>
